Toggle Group
ToggleGroup coordinates related single- or multiple-selection pressed commands using Atom state and keyboard behavior plus Brick recipes.
Built from the published package
Know when Toggle Group is the right part
Use it when
Use it for related view, formatting, or filter commands whose pressed state is meaningful.
Choose another path when
Use Toggle for one command, RadioGroup for form choices, and Tabs for panel navigation. Required selection and persistence remain application policy.
Installation and imports
The complete stylesheet above is the recommended default. For a measured route-aware build, replace it with the shared foundation and this component's stylesheet:
Add the modular stylesheet for every other Brick component the route renders.
Do not combine modular styles with styles.css or tokens.css.
Quick start
Visual recipes and states
Root recipes cascade uniformly to Items. Separated groups use a gap and may
wrap; attached groups join borders and logical corners. fullWidth distributes
Items evenly. Every variant retains a distinct selected treatment.
Examples
API
Start with the public parts and root options below. Components with multiple parts separate each area into its own named subsection.
Public exports are ToggleGroup, ToggleGroupRoot, ToggleGroupItem,
ToggleGroupRootProps, ToggleGroupSingleProps,
ToggleGroupMultipleProps, and ToggleGroupItemProps.
Root is a discriminated union: single mode uses type?: "single", string
values, and (value: string) => void; multiple mode requires
type="multiple", string-array values, and a string-array callback.
| Root prop | Values | Default |
|---|---|---|
variant | solid, soft, outline, ghost | soft |
size | sm, md, lg | md |
shape | rounded, pill | rounded |
attached | boolean | false |
fullWidth | boolean | false |
| Item prop | Values | Default |
|---|---|---|
iconOnly | boolean | false |
Item requires value. Atom supplies
orientation, direction, looping, disabled state, composition, and native props.
Native color is excluded.
Accessibility
Atom owns group semantics, aria-pressed, roving focus, arrows, Home/End,
looping, and disabled-item skipping. Give Root a name when context is
insufficient and give every Item a stable complete name.
Responsive behavior
Separated horizontal groups can wrap; vertical groups stack. Attached groups do not wrap. Logical corners and Atom arrow behavior respect direction.
Styling and tokens
Customization
Set group props first so Items remain consistent, then use public group/Toggle
tokens. Use part className or style only for scoped exceptions.
Tokens and CSS hooks
Stable hooks are .brick-toggle-group, .brick-toggle-group-item, their Atom
slots/state attributes, and Root data-orientation, data-attached,
data-full-width, data-variant, data-size, and data-shape. Item exposes
data-state, data-value, data-disabled, and data-icon-only. Public tokens
are --brick-toggle-group-gap, --brick-toggle-min-block-size,
--brick-toggle-padding-inline, --brick-toggle-gap,
--brick-toggle-radius, and --brick-toggle-icon-size.
Advanced reference
Open these details only when you need to inspect DOM ownership, native forwarding, or lower-level composition.