Skip to main content

ToggleButtonGroup

A segmented control / toggle group (single or multiple selection).

Signature
Density
Viewport
Theme and light/dark are set in the top bar
Live demo
Open ↗

When to use​

A segmented control / toggle group (single or multiple selection).

Accessibility​

Always render a visible <label> (the label prop wires htmlFor/id for you). Errors set aria-invalid and are announced via aria-describedby. Required fields expose aria-required.

Install and import​

npx shadcn@latest add @prism/toggle-button-group
import { ToggleButtonGroup } from '@/components/prism/ToggleButtonGroup';

In a no-build prototype, read it from the bundle instead: const { ToggleButtonGroup } = window.PrismDesignSystem_39d121;

Props​

PropTypeRequiredDescription
itemsToggleItem[]Yes
valuestring | string[]—Controlled value: a string (single) or string[] (multiple).
defaultValuestring | string[]—
selectionMode"single" | "multiple"—
onChange(value: string | string[]) =&gt; void—
isDisabledboolean—
wrapboolean—Let options flow onto more lines instead of scrolling sideways when they don't fit.
selectedVariant"default" | "accent"—"accent" fills the selected segment with the accent — for menus and toolbars where the default raised segment is too subtle.
idstring—Accepted so Field's render props can be spread; a group can't carry them, so they're ignored.
classNamestring—