Button Group
Groups related action buttons into a labelled role="group", optionally joined into one segmented bar.
Import
Section titled “Import”<script> import ButtonGroup from "@invisible-ui/svelte/ButtonGroup.svelte";</script><script setup> import { ButtonGroup } from "@invisible-ui/vue";</script>import { ButtonGroup } from "@invisible-ui/react";<script type="module"> import "@invisible-ui/elements/define";</script>
<ds-button-group></ds-button-group>In Elements:
<ds-button-group label="Text alignment"> <ds-button>Left</ds-button> <ds-button>Center</ds-button> <ds-button>Right</ds-button></ds-button-group>| Prop | Type | Default | Description |
|---|---|---|---|
label * | string | — | Accessible name for the group. |
orientation | Orientation | "horizontal" | Layout direction. |
attached | boolean | true | Visually merge the buttons into one bar. |
align | "start" | "center" | "end" | "stretch" | "center" | Cross-axis alignment of the items. Defaults to center so a taller sibling (e.g. a Select with a label) never stretches the buttons; use end to line buttons up with a labelled control's input row, or stretch for equal heights. |
| Prop | Type | Default | Description |
|---|---|---|---|
label * | string | — | Accessible name for the group (required). |
orientation | ButtonGroupOrientation | "horizontal" | |
attached | boolean | true | Visually merge the buttons into one bar. Defaults to true. |
align | ButtonGroupAlign | "center" | Cross-axis alignment of the items. Defaults to center so a taller sibling (e.g. a Select with a label) keeps the buttons at their own height; use end to line buttons up with a labelled control's input row, or stretch for equal heights. |
Slots: default.
| Prop | Type | Default | Description |
|---|---|---|---|
label * | string | — | Accessible name for the group. |
orientation | ButtonGroupOrientation | "horizontal" | |
attached | boolean | true | Visually merge the buttons into one bar (vs. spacing them apart). |
align | ButtonGroupAlign | "center" | Cross-axis alignment of the items. Defaults to center so a taller sibling (e.g. a Select with a label) never stretches the buttons; use end to line buttons up with a labelled control's input row, or stretch for equal heights. |
children | ReactNode | — | The buttons. |
| Attribute | Reactive | Description |
|---|---|---|
label * | yes | |
orientation | yes | horizontal|vertical |
attached | yes | |
align | yes | start|center|end|stretch |
Reactive attributes re-render the element when they change after the first render.
Accessibility
Section titled “Accessibility”- Renders a labelled
role="group"witharia-orientation. - Holds no selection — each button stays an independent action and tab stop.
Example
Section titled “Example”<ButtonGroup label="Text alignment"> <Button>Left</Button> <Button>Center</Button> <Button>Right</Button></ButtonGroup>In React, the buttons are the children, and align sets their cross-axis
alignment:
<ButtonGroup label="Text alignment" align="end"> <Button>Left</Button> <Button>Center</Button> <Button>Right</Button></ButtonGroup>Themeable via --ds-button-group-*.