ToggleButtonGroup
A ToggleButtonGroup is a grouping of related ToggleButtons, with single or multiple selection.
selectionMode
orientation
size
density
staticColor
isQuiet
isJustified
isDisabled
Selection
Use the selectionMode
prop to enable single or multiple selection. The selected toggle buttons can be controlled via the selectedKeys
prop, matching the id
of each <ToggleButton>
. Toggle buttons can be disabled with the isDisabled
prop. See the selection guide for more details.
Current selection: bold
selectionMode
disallowEmptySelection
API
<ToggleButtonGroup>
<ToggleButton />
</ToggleButtonGroup>
ToggleButtonGroup
Name | Type | Default |
---|---|---|
isEmphasized | boolean | Default: — |
Whether the button should be displayed with an emphasized style. | ||
styles | StylesPropWithHeight | Default: — |
Spectrum-defined styles, returned by the style() macro. | ||
children | ReactNode | Default: — |
The children of the group. | ||
size | 'XS'
| 'S'
| 'M'
| 'L'
| 'XL' | Default: "M"
|
Size of the buttons. | ||
density | 'compact' | 'regular' | Default: "regular"
|
Spacing between the buttons. | ||
isQuiet | boolean | Default: — |
Whether the button should be displayed with a quiet style. | ||
isJustified | boolean | Default: — |
Whether the buttons should divide the container width equally. | ||
staticColor | 'white'
| 'black'
| 'auto' | Default: — |
Whether the button should be displayed with an emphasized style. | ||
orientation | 'horizontal' | 'vertical' | Default: 'horizontal'
|
The axis the group should align with. | ||
isDisabled | boolean | Default: — |
Whether the group is disabled. | ||
selectionMode | 'single' | 'multiple' | Default: 'single'
|
Whether single or multiple selection is enabled. | ||
selectedKeys | Iterable | Default: — |
The currently selected keys in the collection (controlled). | ||
defaultSelectedKeys | Iterable | Default: — |
The initial selected keys in the collection (uncontrolled). | ||
onSelectionChange |
| Default: — |
Handler that is called when the selection changes. | ||
disallowEmptySelection | boolean | Default: — |
Whether the collection allows empty selection. | ||