Toggle Group API
View componentThe full prop reference for the Toggle Group component. A set of two-state buttons that can be single or multiple select.
Import
import { ToggleGroup } from '@structyl/styled';Props
ToggleGroup.Root
Container for toggle group items with controlled/uncontrolled state support. Supports single or multiple selection modes with roving focus navigation.
| Prop | Type | Default |
|---|---|---|
| type# | 'single' | 'multiple'Determines if one or multiple toggles can be active at a time | — |
| value# | string | string[] (based on type)Controlled value(s) of active toggle(s). string for type='single', string[] for type='multiple' | — |
| defaultValue# | string | string[] (based on type)Initial value(s) when uncontrolled. string for type='single', string[] for type='multiple' | — |
| onValueChange# | (value: string | string[]) => voidCallback fired when active toggle(s) change. Receives string for type='single', string[] for type='multiple' | — |
| disabled# | booleanWhether all toggle items are disabled | false |
| orientation# | 'horizontal' | 'vertical'Layout orientation for roving focus navigation | — |
| dir# | 'ltr' | 'rtl'Text direction for roving focus | — |
| rovingFocus# | booleanEnable roving tab focus behavior (arrow keys to navigate, Tab to enter group) | true |
| loop# | booleanWhether focus wraps at the end/start during roving focus navigation | true |
| asChild# | booleanRender as child element (from Radix Slot pattern) | — |
| className# | stringCSS class name (styled layer adds flex items-center justify-center gap-1 as base) | — |
| variant# | 'default' | 'outline'Visual variant for toggle items (styled layer only) | 'default' |
| size# | 'default' | 'sm' | 'lg'Size variant for toggle items: 'sm'=h-9 px-2.5, 'default'=h-10 px-3, 'lg'=h-11 px-5 (styled layer only) | 'default' |
| color# | 'default' | 'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success'Color variant for active state of toggle items (styled layer only) | 'default' |
ToggleGroup.Item
Individual toggle within a toggle group. Acts as a button that can be pressed/unpressed. Inherits variant/size/color from parent Root.
| Prop | Type | Default |
|---|---|---|
| value# | stringUnique identifier for this toggle item within the group | — |
| disabled# | booleanWhether this specific toggle is disabled (combines with Root.disabled) | — |
| asChild# | booleanRender as child element (from Radix Slot pattern) | — |
| className# | stringCSS class name (styled layer applies toggleVariants with inherited variant/size/color) | — |
| variant# | 'default' | 'outline'Visual variant override (styled layer only). Falls back to Root variant if not provided | — |
| size# | 'default' | 'sm' | 'lg'Size variant override (styled layer only). Falls back to Root size if not provided | — |
| color# | 'default' | 'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success'Color variant override (styled layer only). Falls back to Root color if not provided | — |
Source code
If you didn't find what you need here, read the component implementation .