ButtonGroup
Join related buttons into one visual control set.
Use ButtonGroup when adjacent actions should read as one control set. Each child remains its own interactive control; the group supplies layout and shared presentation.
Basic usage#
Playground#
Anatomy#
The group owns its separators; the caller supplies the child Buttons and their content.
Usage#
Composition#
Use ButtonGroup to align related actions without changing their semantics. Add ButtonGroup.Separator where a divider helps; it accepts direct class and style. Root classes and styles set defaults for the root and separator slots. Compose a menu or popover trigger as a child when an action needs an overlay.
Examples#
Toggle buttons#
Compose ToggleButton children for independently enabled actions. They inherit the group’s size and unpressed variant; activeVariant controls each button’s pressed appearance. ButtonGroup supplies layout and does not coordinate selection or add toolbar keyboard navigation.
Separator#
Insert ButtonGroup.Separator only where an explicit boundary is useful. Its orientation follows the group axis: vertical in a horizontal group and horizontal in a vertical group. An explicit orientation overrides this default.
Dropdown menu composition#
Popover composition#
Vertical layout#
Attributes#
data-orientationSlot: button-group-separatorDescription: Stores the rendered orientation (horizontal or vertical).Props#
ButtonGroup#
Props for the ButtonGroup component. Renders a <div> element by default.
Separator#
Props for the ButtonGroup.Separator component. Renders a <div> element by default.