Checkbox Group

Checkbox Group

Forms
Component

Group multiple checkboxes together with shared state management. Supports vertical and horizontal layouts, descriptions, and card-style variants.

Built With

2 components

This block uses the following UI components from the design system:

Preview

Basic checkbox group with vertical layout

Notification preferences

Selected: email

Horizontal Layout

Options displayed in a row

Select file types

With Descriptions

Checkboxes with additional context

Email preferences

Receive emails about new products and features

Get notified when we ship new features

Important alerts about your account security

You can change these settings anytime

With Error

Validation error state

Accept terms

Disabled Options

Individual options can be disabled

Features

Upgrade to enable advanced features

Checkbox Card Group

Card-style checkboxes with icons

Select features to enable

Single Column Cards

Full-width card checkboxes

Permissions

CheckboxGroup Props

CheckboxGroup API reference

PropTypeDefaultDescription
options*CheckboxGroupOption[]—Array of checkbox options
valuestring[]—Controlled selected values
defaultValuestring[][]Default selected values (uncontrolled)
onChange(value: string[]) => void—Callback when selection changes
labelstring—Group label
helperTextstring—Helper text below group
errorstring—Error message
orientation'vertical' | 'horizontal''vertical'Layout direction
disabledbooleanfalseDisable entire group
namestring—Name attribute for form submission

CheckboxCardGroup Props

CheckboxCardGroup API reference

PropTypeDefaultDescription
options*CheckboxCardOption[]—Array of card options with optional icon
valuestring[]—Controlled selected values
defaultValuestring[][]Default selected values
onChange(value: string[]) => void—Callback when selection changes
labelstring—Group label
columns1 | 2 | 3 | 41Number of columns in grid
disabledbooleanfalseDisable entire group

Types

Supporting type definitions

interface CheckboxGroupOption {
value: string
label: string
description?: string
disabled?: boolean
}
interface CheckboxCardOption {
value: string
label: string
description?: string
icon?: React.ReactNode
disabled?: boolean
}

Usage

Import and implementation example

import { CheckboxGroup, CheckboxCardGroup } from '@/components/ui/checkbox-group'
export default function Example() {
const [selected, setSelected] = useState<string[]>([])
return (
<>
{/* Basic checkbox group */}
<CheckboxGroup
label="Select options"
options={[
{ value: 'opt1', label: 'Option 1' },
{ value: 'opt2', label: 'Option 2' },
{ value: 'opt3', label: 'Option 3' },
]}
value={selected}
onChange={setSelected}
/>
{/* Horizontal layout */}
<CheckboxGroup
options={options}
orientation="horizontal"
/>
{/* Card style with icons */}
<CheckboxCardGroup
options={[
{ value: 'a', label: 'Feature A', icon: <Icon /> },
{ value: 'b', label: 'Feature B', icon: <Icon /> },
]}
columns={2}
value={selected}
onChange={setSelected}
/>
</>
)
}

Features

Built-in functionality

  • Controlled & uncontrolled: Flexible state management options
  • Vertical & horizontal: Two layout orientations
  • Option descriptions: Additional context for each option
  • Error states: Built-in validation message display
  • Card variant: Rich card-style checkboxes with icons
  • Responsive grid: Card group supports 1-4 column layouts
  • Form compatible: Works with native form submission via name prop

Accessibility

Accessibility considerations

ARIA Attributes

Uses role="group" with aria-labelledby for group labelingaria-describedby links to error or helper textEach checkbox has proper label association

Keyboard Navigation

KeyAction
TabNavigate between checkboxes
SpaceToggle checkbox state

Notes

  • Group label announced by screen readers
  • Error messages announced via role="alert"
  • Disabled state properly conveyed to assistive technology