Skip to content

CheckboxCard

Card-style checkbox with label and description.

Also known as: selection card, toggle card, option card with checkbox

View in Storybook

When to use

  • Rich checkbox with label and description (settings, feature toggles, plan selection). For simple checkboxes, use Checkbox.
  • For mutual exclusion cards, use RadioCard.

Import

tsx
import { CheckboxCard } from '@vacano/ui'

Usage

tsx
const [checked, setChecked] = useState(false)

<CheckboxCard
  checked={checked}
  onChange={(e) => setChecked(e.target.checked)}
  label="Premium Plan"
  description="Access all features and priority support"
/>

With Description

tsx
<CheckboxCard
  checked={true}
  onChange={() => {}}
  label="Email notifications"
  description="Receive updates about your account"
/>

Full Width

tsx
<CheckboxCard
  fullWidth
  checked={false}
  onChange={() => {}}
  label="Full Width Card"
  description="This card takes full width"
/>

Variants

tsx
<CheckboxCard variant="normal" checked={true} onChange={() => {}} label="Normal" />
<CheckboxCard variant="error" checked={true} onChange={() => {}} label="Error" />

Disabled

tsx
<CheckboxCard disabled checked={true} onChange={() => {}} label="Disabled" />

Props

PropTypeDefaultDescription
checkedbooleanrequiredChecked state
onChangeChangeEventHandler<HTMLInputElement>requiredChange handler
labelstringrequiredLabel text
descriptionstring-Description text
fullWidthbooleanfalseFull width card
variant'normal' | 'error''normal'Visual variant
disabledbooleanfalseDisable card
classNamestring-CSS class for root element
classnamesCheckboxCardClassNames-Custom class names for inner elements
refRef<HTMLInputElement>-Ref to the underlying input element
data-test-idstring-Test identifier for automated testing

Also accepts all standard InputHTMLAttributes<HTMLInputElement> except type, checked, onChange, and className.

ClassNames

KeyDescription
checkboxCheckbox element
contentContent container
labelLabel text
descriptionDescription text

Released under the MIT License.