Skip to content

CheckboxGroup

A controlled checkbox group for multi-value selection.

Notification channelsChoose any channels that apply.
Best for detailed updates.
<CheckboxGroup
description="Choose any channels that apply."
label="Notification channels"
value={['email', 'push']}
/>
Notification channelsChoose any channels that apply.
Best for detailed updates.
<CheckboxGroup
description="Choose any channels that apply."
label="Notification channels"
value={['email', 'push']}
orientation="horizontal"
/>
TeamsChoose the teams that should receive access.
function WrappingRowStory(args: CheckboxGroupProps): React.JSX.Element {
const [value, setValue] = useState(args.value);
return (
<CheckboxGroup
{...args}
onChange={setValue}
orientation="horizontal"
style={{maxWidth: 420}}
value={value}>
<CheckboxGroupItem label="Design" value="design" />
<CheckboxGroupItem label="Engineering" value="engineering" />
<CheckboxGroupItem label="Marketing" value="marketing" />
<CheckboxGroupItem label="Operations" value="operations" />
<CheckboxGroupItem label="Support" value="support" />
</CheckboxGroup>
);
}
<WrappingRowStory {...args} />
Notification channelsChoose any channels that apply.
Best for detailed updates.
<CheckboxGroup
description="Choose any channels that apply."
label="Notification channels"
value={['email', 'push']}
size="sm"
/>
Notification channelsChoose any channels that apply.
Best for detailed updates.
<CheckboxGroup
description="Choose any channels that apply."
label="Notification channels"
value={['email', 'push']}
size="lg"
/>
Notification channelsChoose any channels that apply.
Best for detailed updates.
<CheckboxGroup
description="Choose any channels that apply."
label="Notification channels"
value={['email', 'push']}
isDisabled
/>
Notification channelsChoose any channels that apply.
function ItemDisabledStory(args: CheckboxGroupProps): React.JSX.Element {
const [value, setValue] = useState(args.value);
return (
<CheckboxGroup {...args} onChange={setValue} value={value}>
<CheckboxGroupItem label="Email" value="email" />
<CheckboxGroupItem isDisabled label="SMS" value="sms" />
<CheckboxGroupItem label="Push" value="push" />
</CheckboxGroup>
);
}
<ItemDisabledStory {...args} />
Notification channelsRequiredChoose any channels that apply.
Best for detailed updates.
<CheckboxGroup
description="Choose any channels that apply."
label="Notification channels"
value={['email', 'push']}
isRequired
/>
Notification channelsOptionalChoose any channels that apply.
Best for detailed updates.
<CheckboxGroup
description="Choose any channels that apply."
label="Notification channels"
value={['email', 'push']}
isOptional
/>
Notification channelsChoose any channels that apply.
Best for detailed updates.
<CheckboxGroup
description="Choose any channels that apply."
label="Notification channels"
value={[]}
status={{ message: 'Select at least one notification channel.', type: 'error', }}
/>
Notification channelsChoose any channels that apply.
Recommended
function WithEndContentStory(args: CheckboxGroupProps): React.JSX.Element {
const [value, setValue] = useState(args.value);
return (
<CheckboxGroup {...args} onChange={setValue} value={value}>
<CheckboxGroupItem
endContent={<Badge color="blue" label="Recommended" />}
label="Email"
value="email"
/>
<CheckboxGroupItem label="SMS" value="sms" />
<CheckboxGroupItem label="Push" value="push" />
</CheckboxGroup>
);
}
<WithEndContentStory {...args} />
Notification channelsChoose any channels that apply.
function WithIconsStory(args: CheckboxGroupProps): React.JSX.Element {
const [value, setValue] = useState(args.value);
return (
<CheckboxGroup {...args} onChange={setValue} value={value}>
<CheckboxGroupItem
label="Email"
startContent={<Icon color="secondary" icon={Mail} size="sm" />}
value="email"
/>
<CheckboxGroupItem
label="SMS"
startContent={<Icon color="secondary" icon={MessageSquare} size="sm" />}
value="sms"
/>
<CheckboxGroupItem
label="Push"
startContent={<Icon color="secondary" icon={Bell} size="sm" />}
value="push"
/>
</CheckboxGroup>
);
}
<WithIconsStory {...args} />
Notification channelsChoose any channels that apply.
Best for detailed updates.
SMS may incur carrier charges.
<CheckboxGroup
description="Choose any channels that apply."
label="Notification channels"
value={['email', 'push']}
status={{message: 'SMS may incur carrier charges.', type: 'warning'}}
/>
Notification channelsChoose any channels that apply.
Best for detailed updates.
Preferences saved.
<CheckboxGroup
description="Choose any channels that apply."
label="Notification channels"
value={['email', 'push']}
status={{message: 'Preferences saved.', type: 'success'}}
/>
Notification channelsChoose any channels that apply.
Best for detailed updates.
<CheckboxGroup
description="Choose any channels that apply."
label="Notification channels"
value={['email', 'push']}
isReadOnly
/>

A controlled checkbox group for multi-value selection.

When isOptional: false, isRequired: false

PropTypeDefaultDescription
children*ReactNodeCheckbox items to render.
classNamestringAdditional CSS class names applied to the field root.
data-testidstringTest ID applied to the field root.
descriptionReactNodeSupporting text displayed below the label.
htmlNamestringHTML name attribute shared by checkbox inputs for native form submission.
isDisabledbooleanfalseWhether all checkbox items are disabled.
isReadOnlybooleanfalseWhether all checkbox items are read-only.
isLabelHiddenbooleanfalseWhether to visually hide the label.
label*stringLabel text for the checkbox group.
labelTooltipReactNodeTooltip content shown next to the label.
onChange*(value: string[]) => voidCallback fired when the selected values change. Memoize with useCallback to avoid unnecessary re-renders of checkbox items.
orientation"horizontal" | "vertical"'vertical'Layout direction of the checkbox items.
refRef<HTMLDivElement>Ref forwarded to the field root.
size"sm" | "md" | "lg"'md'Size of the checkbox controls.
statusInputStatusValidation status displayed below the group.
styleCSSPropertiesInline styles applied to the field root.
value*string[]The currently selected values.
isOptionalfalse
isRequiredfalse

When isOptional: true, isRequired: false

PropTypeDefaultDescription
children*ReactNodeCheckbox items to render.
classNamestringAdditional CSS class names applied to the field root.
data-testidstringTest ID applied to the field root.
descriptionReactNodeSupporting text displayed below the label.
htmlNamestringHTML name attribute shared by checkbox inputs for native form submission.
isDisabledbooleanfalseWhether all checkbox items are disabled.
isReadOnlybooleanfalseWhether all checkbox items are read-only.
isLabelHiddenbooleanfalseWhether to visually hide the label.
label*stringLabel text for the checkbox group.
labelTooltipReactNodeTooltip content shown next to the label.
onChange*(value: string[]) => voidCallback fired when the selected values change. Memoize with useCallback to avoid unnecessary re-renders of checkbox items.
orientation"horizontal" | "vertical"'vertical'Layout direction of the checkbox items.
refRef<HTMLDivElement>Ref forwarded to the field root.
size"sm" | "md" | "lg"'md'Size of the checkbox controls.
statusInputStatusValidation status displayed below the group.
styleCSSPropertiesInline styles applied to the field root.
value*string[]The currently selected values.
isOptional*true
isRequiredfalse

When isOptional: false, isRequired: true

PropTypeDefaultDescription
children*ReactNodeCheckbox items to render.
classNamestringAdditional CSS class names applied to the field root.
data-testidstringTest ID applied to the field root.
descriptionReactNodeSupporting text displayed below the label.
htmlNamestringHTML name attribute shared by checkbox inputs for native form submission.
isDisabledbooleanfalseWhether all checkbox items are disabled.
isReadOnlybooleanfalseWhether all checkbox items are read-only.
isLabelHiddenbooleanfalseWhether to visually hide the label.
label*stringLabel text for the checkbox group.
labelTooltipReactNodeTooltip content shown next to the label.
onChange*(value: string[]) => voidCallback fired when the selected values change. Memoize with useCallback to avoid unnecessary re-renders of checkbox items.
orientation"horizontal" | "vertical"'vertical'Layout direction of the checkbox items.
refRef<HTMLDivElement>Ref forwarded to the field root.
size"sm" | "md" | "lg"'md'Size of the checkbox controls.
statusInputStatusValidation status displayed below the group.
styleCSSPropertiesInline styles applied to the field root.
value*string[]The currently selected values.
isOptionalfalse
isRequired*true

An individual checkbox option within a `CheckboxGroup`.

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the item root.
data-testidstringTest ID applied to the input element.
descriptionReactNodeSupporting text displayed below the item label.
endContentReactNodeContent rendered after the label and description.
endContentPositionCheckboxInputProps['endContentPosition']'inline'Where to place endContent within the item.
isDisabledbooleanfalseWhether this checkbox item is disabled.
isReadOnlybooleanfalseWhether this checkbox item is read-only.
label*stringLabel text for the checkbox item.
refRef<HTMLInputElement>Ref forwarded to the input element.
startContentReactNodeContent rendered after the checkbox control and before the label.
styleCSSPropertiesInline styles applied to the item root.
value*stringValue represented by this checkbox item.