When to use
Section titled “When to use”CheckboxGroup offers several choices for the same question together: notification channels, interests, filter values.
When not to use
Section titled “When not to use”- For a single choice: Use a radio group or a Select.
- For one independent consent: A single Checkbox is enough.
- For long lists: Lists over about 10 options need search.
Anatomy
Section titled “Anatomy”import { Checkbox, CheckboxGroup } from '@bigbang/ui';
export default function Default() { return ( <CheckboxGroup label="Group label" description="You can choose more than one option." defaultValue={['one']}> <Checkbox value="one" label="First option" /> <Checkbox value="two" label="Second option" /> <Checkbox value="three" label="Third option" /> </CheckboxGroup> );}- Legend:
<legend>;label-md, with the necessity marker when needed. - Help text:
description. - Items: Checkbox components, each with a
value. - Error:
error; under the items.
Behaviour
Section titled “Behaviour”- The group holds the values of the checked items as an array.
- With
allValues, aparentCheckbox checks or clears them all. - The legend and help text are linked to the group, the error after the help text.
disabledturns off every item.
Guidelines
Section titled “Guidelines”- Write the legend as a question or topic: “Notification channels”.
- Order the options meaningfully.
- In a required group, ask for at least one choice and say so in the error text.
Content
Section titled “Content”- The legend is a short noun phrase or a question.
- Item labels share the same grammatical form.
| Turkish | English |
|---|---|
| Tümü | All |
| En az bir seçenek seçin. | Choose at least one option. |
Related components
Section titled “Related components”- Checkbox: the item of the group.
- Select: a single choice from a short list.
- ToggleGroup: options that take effect at once.