Components Actions
ButtonGroup
StableGroups related buttons, either joined into a segmented bar or evenly spaced.
Use ButtonGroup to show that several actions belong together, such as export formats or pagination steps. Attached groups read as one control; spaced groups simply align actions like dialog footers. For buttons that hold an on/off state, use ToggleButtonGroup instead.
Overview
import { Button, ButtonGroup } from '@bindshq/stance-react';
export function Attached() {
return (
<ButtonGroup label="Export as">
<Button variant="outline">PDF</Button>
<Button variant="outline">HTML</Button>
<Button variant="outline">Plain text</Button>
</ButtonGroup>
);
}Light, dark and high contrast
Every Stance component is designed and tested in all three appearance modes.
Import
import { ButtonGroup } from '@bindshq/stance-react';Platforms
ButtonGroup has native counterparts. They share Stance tokens and intent, and use each platform’s own controls and conventions. The live previews on this page are the web implementation.
import { ButtonGroup } from '@bindshq/stance-react';Examples
import { Button, ButtonGroup } from '@bindshq/stance-react';
export function Spaced() {
return (
<ButtonGroup variant="spaced" label="Template actions">
<Button variant="ghost">Cancel</Button>
<Button variant="outline">Save draft</Button>
<Button>Publish</Button>
</ButtonGroup>
);
}import { Button, ButtonGroup } from '@bindshq/stance-react';
export function Vertical() {
return (
<ButtonGroup orientation="vertical" label="Deploy to">
<Button variant="outline">Microsoft 365</Button>
<Button variant="outline">Google Workspace</Button>
<Button variant="outline">Exchange relay</Button>
</ButtonGroup>
);
}import { Button, ButtonGroup, Icon, IconButton } from '@bindshq/stance-react';
export function WithIconButtons() {
return (
<ButtonGroup label="Zoom">
<IconButton variant="outline" label="Zoom out" icon={<Icon name="minus" />} />
<Button variant="outline">100%</Button>
<IconButton variant="outline" label="Zoom in" icon={<Icon name="plus" />} />
</ButtonGroup>
);
}API reference
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'attached' | 'spaced' | 'attached' | Join buttons or keep a gap between them. |
orientation | 'horizontal' | 'vertical' | 'horizontal' | Layout direction. |
label | string | None | Accessible name for the group. |
fullWidth | boolean | false | Buttons share the full container width. |
Accessibility
- Renders role="group"; provide label so screen readers announce what the buttons relate to.
- Each button remains its own tab stop. For a single tab stop with arrow keys, use Toolbar or ToggleButtonGroup.
Keyboard
| Keys | Action |
|---|---|
| Tab | Moves between the buttons in the group. |
Usage guidelines
Do
- Keep attached groups to between two and five actions of equal importance.
Don’t
- Mix primary and outline buttons in one attached group.