When to use
Section titled “When to use”ButtonGroup is for buttons that make sense together: previous and next page, an action with its options menu, the footer actions of a dialog.
When not to use
Section titled “When not to use”- When one option stays pressed: Use ToggleGroup; it adds arrow keys and the pressed state.
- For independent actions: Lay the buttons out with Inline; no group name is needed.
- For navigation between pages: Build links with Link.
Anatomy
Section titled “Anatomy”import { ButtonGroup, IconButton } from '@bigbang/ui';
export default function Attached() { return ( <ButtonGroup attached label="Pages"> <IconButton variant="secondary" icon="chevron-left" label="Previous" /> <IconButton variant="secondary" icon="chevron-right" label="Next" /> </ButtonGroup> );}- Container: a
<div>withrole="group"; withlabelit is named througharia-label. - Buttons: Button or IconButton items of one size.
- Shared border: with
attached, inner corners turn square and borders overlap by 1 px.
Behaviour
Section titled “Behaviour”- Each button is its own tab stop; arrow keys are not used.
- In an attached group the focused button comes to the front (
z-index: 1); its focus ring is not hidden under its neighbour. - Corners use logical sides (
rounded-s,rounded-e); in right-to-left text the joint is mirrored. - ButtonGroup has no motion of its own; each button keeps the Button press motion.
Guidelines
Section titled “Guidelines”- Use one
sizein a group; usesecondarybuttons in an attached group. - Keep at most one
primarybutton in a group, and put it last. - Give a
labelonly when the buttons make sense together: “Pages”. - If an attached group has more than three buttons, consider moving them to a menu.
Content
Section titled “Content”labelis a noun phrase that names the topic of the group, not a verb.- Keep the button texts in the same grammatical form: “Previous”, “Next”.
| Turkish | English |
|---|---|
| Sayfalar | Pages |
| Önceki | Previous |
| Sonraki | Next |
Related components
Section titled “Related components”- Button: the items of the group.
- IconButton: icon-only items.
- ToggleGroup: options that stay pressed.
- Inline: lays out independent items side by side.