React
Usage
import { ToggleGroup } from '@zalify-ui/react'
<ToggleGroup.Root>
<ToggleGroup.Item />
</ToggleGroup.Root>
Examples
Multiple
Use the multiple prop to allow multiple items to be selected at once.
React
Toolbar
Here is an a toggle group used as a toolbar with icon buttons.
React
Props
Root
| Prop | Default | Type |
|---|---|---|
deselectable | true | booleanWhether the toggle group allows empty selection. **Note:** This is ignored if `multiple` is `true`. |
loopFocus | true | booleanWhether to loop focus inside the toggle group. |
orientation | \horizontal\ | OrientationThe orientation of the toggle group. |
rovingFocus | true | booleanWhether to use roving tab index to manage focus. |
variant | 'outline' | |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. | |
defaultValue | string[]The initial selected value of the toggle group when rendered. Use when you don't need to control the selected value of the toggle group. | |
disabled | booleanWhether the toggle is disabled. | |
id | stringThe unique identifier of the machine. | |
ids | Partial<{ root: string; item: (value: string) => string }>The ids of the elements in the toggle. Useful for composition. | |
multiple | booleanWhether to allow multiple toggles to be selected. | |
onValueChange | (details: ValueChangeDetails) => voidFunction to call when the toggle is clicked. | |
value | string[]The controlled selected value of the toggle group. |
Item
| Prop | Default | Type |
|---|---|---|
value* | string | |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. | |
disabled | boolean |