ToggleGroup

A set of toggle buttons for single or multiple selection

Category: inputs · WCAG 2.2-AA · selection, segmented, toolbar, choice

Variants

Sizes

States

Props

PropTypeDefaultDescription
type'single' | 'multiple'Whether one or multiple items can be pressed at once ('single' | 'multiple').
valuestring | string[]The controlled value.
defaultValuestring | string[]The initial value when uncontrolled.
onValueChange(value: string | string[]) => voidCalled with the new value when it changes.
items{ value: string; label?: string; icon?: React.ReactNode; disabled?: boolean }[]The items to render.
orientation'horizontal' | 'vertical'horizontalLayout orientation of the component.
size'sm' | 'md' | 'lg'mdVisual size of the component (e.g. 'sm', 'md', 'lg').
disabledbooleanfalseWhen true, disables the control and removes it from the tab order.

Design tokens

When to use

When not to use

How to build an accessible ToggleGroup in React →

Examples

Single selection

<ToggleGroup type="single" defaultValue="left" items={[{ value: "left", label: "Left" }, { value: "center", label: "Center" }, { value: "right", label: "Right" }]} />

Multiple selection

<ToggleGroup type="multiple" defaultValue={["bold"]} items={[{ value: "bold", label: "Bold" }, { value: "italic", label: "Italic" }]} />

Related components

← Back to docs