Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
Composition
ToggleGroup └── ToggleGroupItem
Examples
Custom
Loading...
Default
Loading...
Disabled
Loading...
Orientation
Loading...
Sizes
Loading...
Spacing
Loading...
Variants
Loading...
API Reference
ToggleGroup
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | undefined | — | Unique identifier used to connect the component parts. |
ids | ElementIds | undefined | — | Overrides generated identifiers for individual parts. |
disabled | boolean | undefined | false | Disables interaction with the component. |
value | string[] | undefined | — | Current value when the component is controlled. |
defaultValue | string[] | undefined | — | Initial value when the component is uncontrolled. |
onValueChange | ((details: ValueChangeDetails) => void) | undefined | — | Runs when value changes. |
loopFocus | boolean | undefined | — | Configures loop focus. |
rovingFocus | boolean | undefined | — | Configures roving focus. |
orientation | Orientation | undefined | "horizontal" | Sets the component orientation and keyboard navigation axis. |
multiple | boolean | undefined | false | Allows more than one value to be selected or expanded. |
deselectable | boolean | undefined | — | Configures deselectable. |
Context, Hooks, and Types
| Export | API |
|---|---|
ToggleGroupArkContext | Render-prop component that exposes component state and actions. |
ToggleGroupRootProvider | Provides an externally created API to the component tree. |
useToggleGroup | Creates or accesses the component API. |
useToggleGroupContext | Returns the nearest component API. |
ToggleGroupValueChangeDetails | Type for the details object passed to the matching change callback. |
Angular
React
Solid
Svelte
Vue