-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0498a3a
commit ba86807
Showing
6 changed files
with
203 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { Meta, Description, Canvas, ArgTypes } from '@storybook/blocks'; | ||
import * as Stories from './CheckboxGroup.stories'; | ||
import { Stack } from '../Stack'; | ||
import { Box } from '../Box'; | ||
import { Text } from '../Text'; | ||
import { Divider } from '../Divider'; | ||
|
||
<Meta of={Stories} /> | ||
|
||
# CheckboxGroup | ||
|
||
<Description of={Stories} /> | ||
|
||
## Contents | ||
|
||
- [Alternatives](#alternatives) | ||
- [Accessibility](#accessibility) | ||
- [Helper text](#helper-text) | ||
- [Error message](#error-message) | ||
- [Content width](#content-width) | ||
- [Controlled](#controlled) | ||
- [Props](#props) | ||
|
||
<Canvas of={Stories.Workshop} /> | ||
|
||
## Alternatives | ||
|
||
- [CheckboxGridGroup](?path=/docs/components-checkboxgridgroup--documentation) - For presenting checkboxes in columns or a grid layout. | ||
- [RadioGroup](?path=/docs/components-radiogroup--documentation) - For single-select | ||
- [RadioGridGroup](?path=/docs/components-radiogridgroup--documentation) - For single-select in columns or a grid layout. | ||
|
||
## Accessibility | ||
|
||
The necessary aria props, such as `aria-labelledby`, `aria-describedby` and | ||
`aria-errormessage` are handled internally, however you can pass these and | ||
other aria props, such as `aria-label`, to the `CheckboxGroup`, `Checkbox` & | ||
`CheckboxTile` components yourself if you need to. | ||
|
||
## Helper text | ||
|
||
The Checkbox group can display a secondary message as a helper text. This can be | ||
either above or below the group's checkbox items. While the checkbox items can also | ||
display a helper text, these will not be displayed if the checkbox group has a | ||
helper text. | ||
|
||
<Canvas of={Stories.CheckboxHelperText} /> | ||
|
||
## Error message | ||
|
||
You can display an error using the `error` & `errorMessage` props. | ||
|
||
<Canvas of={Stories.ShowingError} /> | ||
|
||
## Content width | ||
|
||
The width of the `CheckboxGroup` should be set by the parent layout, however it is | ||
possible to independently set the width of the children using `contentWidth` | ||
prop. This property is most useful when using the `CheckboxGroup` with the | ||
`CheckboxTile` component. | ||
|
||
By default it will set the width of the children to fit their content, however | ||
you can set it to a specific width, or to `100%` to take up the full width of | ||
the `CheckboxGroup`. | ||
|
||
This is a responsive property, so you are able to set different widths for | ||
different breakpoints. | ||
|
||
<Canvas of={Stories.ContentWidth} /> | ||
|
||
## Controlled | ||
|
||
A controlled value can be provided using the value prop, which accepts a string | ||
array, corresponding to the value props of each child `Checkbox`. The | ||
`onValueChange` event is fired when the user selects or deselects a `Checkbox` | ||
child of the group. | ||
|
||
<Canvas of={Stories.Controlled} /> | ||
|
||
## Props | ||
|
||
<ArgTypes of={Stories} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters