Skip to content
uiify

Toggle group

Group of toggles with single or multiple selection and roving focus.

Browsers
Chrome 123+Firefox 121+Safari 17.5+
Tier
0
Bundle compressed
1.00 kB
Forced layout budget
0 ms
Axe budget
0
SSR compatible
Yes
Built on
elements/choice
Published contract
Test harness

Playground

Toggle group

Single

Multiple

API

ToggleGroup

PropTypeDefaultDescription
id*string—Base for the deterministic ids and the shared input group name.
type"single" | "multiple""single"Whether one or several toggles may be pressed, choosing radio or checkbox inputs.
items*readonly ToggleGroupItem[]—Each item is { value, label, disabled? }.
defaultValuestring | readonly string[] | undefined—Pressed on first render. Uncontrolled, so it survives with no JavaScript.
valuestring | readonly string[]—Controlled value on ToggleGroupClient; single uses a string and multiple uses an array.
onValueChange(value) => void—Change callback on ToggleGroupClient; use ToggleGroupClient for client-side state.
disabledbooleanfalseDisables every item and marks the group with data-disabled.
aria-label / aria-labelledbystring—Accessible name for the group; provide one when no visible group label exists.
orientation"horizontal" | "vertical""horizontal"Direction the toggles are laid out in.
classNamestring—Class applied to the group root.

Keyboard

KeyAction
TabMove focus to the group
Arrow keysRove between items
SpaceToggle the focused item

Accessibility

Uses a labeled native radiogroup for single selection or group for multiple selection. Use ToggleGroupClient for controlled value/onValueChange behavior.

Styling hooks

data-statedata-disabled