Install
Pull Toggle Group from the barrel for everyday use, or the granular path when you want a tighter bundle.
import { ToggleGroup } from "@brika/clay";import { ToggleGroup } from "@brika/clay/components/toggle-group";A minimal example
Drop this into a page. Native HTML attributes pass through to the underlying primitive.
import { ToggleGroup, ToggleGroupItem } from '@brika/clay/components/toggle-group';
import { AlignCenter, AlignLeft, AlignRight } from 'lucide-react';
/** Single-selection alignment picker, only one item active at a time. */
export default function ToggleGroupDefaultDemo() {
return (
<ToggleGroup type="single" defaultValue="center">
<ToggleGroupItem value="left" aria-label="Align left">
<AlignLeft />
</ToggleGroupItem>
<ToggleGroupItem value="center" aria-label="Align center">
<AlignCenter />
</ToggleGroupItem>
<ToggleGroupItem value="right" aria-label="Align right">
<AlignRight />
</ToggleGroupItem>
</ToggleGroup>
);
}Toggle Group, every way
Disabled
Individual items can be disabled while the rest remain interactive.
Multiple
Multiple-selection formatting group, any combination can be active.
Text
Text-label items, suitable for view switchers and segmented controls.
Vertical
Vertical orientation stacks items top-to-bottom with shared dividers.
Accessibility
- Arrow keys navigate between items within the group; Space toggles the focused item.
-
type="single"enforces one active item at a time;type="multiple"allows combinations. - Icon-only items require
aria-labelon eachToggleGroupItem. - The group wrapper carries
role="group", addaria-labelto describe the group's purpose.
Theme tokens
Every CSS variable Toggle Group reads, with its default and the
dotted path you'd write in a ThemeConfig JSON
to override it. Set any of these in your theme to retune Toggle Group
without touching component code.
Toggle Group tokens
3 tokens--toggle-group-frame-containercolorvar(--input-container)components.toggleGroup.frameContainerBackground fill of the toggle-group frame. Defaults to the `--input-container` role so a group reads as a single grouped control matching other inputs.
--toggle-group-frame-bordercolorvar(--input-border)components.toggleGroup.frameBorderBorder color of the toggle-group outer frame. Defaults to the `--input-border` role so the frame matches other input edges.
--toggle-group-divider-colorcolorvar(--input-border)components.toggleGroup.dividerColorColor of the 1px separator drawn between adjacent items inside the group (left edge in horizontal orientation, top edge in vertical). Defaults to `--input-border` so dividers blend with the frame.
Override in a theme
Authoring a theme is plain JSON. Drop overrides under
components.toggleGroup, the names
are camelCase versions of the variable suffix.
{
"id": "my-theme",
"name": "My Theme",
"description": "...",
"accentSwatches": ["#000"],
"components": {
"toggleGroup": {
"frameContainer": "var(--input-container)"
}
}
}
Then apply with applyTheme(myTheme)
(see the theming guide),
scope it to a subtree with themeToCssVars(myTheme, mode),
or consume any token directly in your own JSX with the matching Tailwind utility
(e.g. bg-toggle-group-…) — see the
chips on each token row.
API reference
Props specific to Toggle Group. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.
<ToggleGroup />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<ToggleGroupContext />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<ToggleGroupItem />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.