Components
ButtonGroup
A labelled group of buttons with joined borders, a vertical orientation and group-wide variant, tone, size and disabled defaults.
import { Button, ButtonGroup } from '@salmonui/buttons/button';
import '@salmonui/buttons/button/styles.css';
<ButtonGroup aria-label="Clipboard" variant="outline">
<Button>Cut</Button>
<Button>Copy</Button>
<Button>Paste</Button>
</ButtonGroup>;
ButtonGroup groups related buttons into one labelled control. It renders
<div role="group">, named by aria-label or aria-labelledby.
orientation:'horizontal'(default) or'vertical'.attached(defaulttrue) joins borders and shares corners;falsespaces the buttons.variant,tone,sizeanddisabledon the group are the defaults of every button inside; a button's own prop wins. Groupdisabledalso follows a surrounding<fieldset disabled>.Ghost groups (
variant="ghost") are supported with joined borders; round buttons follow the Button rule (no shape props).The group adds no keyboard model: every button is its own tab stop and Enter / Space activate it. For one tab stop with arrow keys use a
ToggleButtonGroup.MenuButtonandSplitButtoncan be group children, also in a vertical group; see Split Button. The group inheritsdirand uses logical CSS, so it mirrors underdir="rtl".The group has no state and no events of its own; it renders on the server like any element.
.salmon-button-groupcarriesdata-orientationanddata-attached, andclassName,styleand other DOM props reach the<div>.
Button groups
Open demoAttached and spaced groups, a vertical group, group styles inherited by the buttons with per-button overrides, and a disabled group.
Rendering
The group is a component, not a decoration applied to existing DOM after
mount, so it renders on the server like the buttons inside it.
Per-button options go on the Button children.
API reference
ButtonGroup and
ButtonGroupProps in @salmonui/buttons/button.