ButtonGroup
Shares variant, colorScheme, and size across child Buttons; optionally renders them as a single attached segmented surface.
Renders a div with role="group"; child buttons keep their own labels and remain individually focusable.
Attached
Section titled “Attached”Set attached to render the group as a segmented control — the buttons float as tiles inside a tinted, padded track (the same container NumberInput and ToggleGroup use).
Shared variant and size
Section titled “Shared variant and size”variant, colorScheme, and size on the group flow to every child Button through context so a toolbar stays visually consistent with one declaration.
Per-button overrides
Section titled “Per-button overrides”Props on a child Button always win over the group context — handy for highlighting the active item in a segmented control.
PropTypeDefaultDescription
variant
"solid"|"soft"|"outline"|"ghost"|"link"
—
Shared visual style for every nested `<Button>`. Individual buttons can
still override by passing their own `variant` prop.
colorScheme
"accent"|"neutral"|"success"|"danger"|"warning"
—
Shared colour palette for every nested `<Button>`.
size
"xs"|"sm"|"md"|"lg"|"xl"
—
Shared size for every nested `<Button>`.
attached
boolean
—
When `true`, buttons render as a segmented control: tiles floating inside
a tinted, padded track (the same container `NumberInput` and
`ToggleGroup`'s attached bar use).
Accessibility
Section titled “Accessibility”- Wrapper is a
divwithrole="group"; passaria-labelso assistive tech can describe what the group is for. - Children remain native
<button>elements with their own focus, activation, and labels. - Use
aria-pressedon child Buttons when emulating a segmented control with selection state. attachedis purely visual — it does not change keyboard or focus semantics.
Recipes
Section titled “Recipes”- Pair
attachedwithvariant="outline"for a classic segmented-control look; the track supplies the frame, so buttons keep their own surface. - Mix in
IconButtonchildren for compact toolbars without breaking the shared variant. - For mutually exclusive selection, drive state in the parent and flip the active child’s
variant.