ButtonGroup

Visually joins a set of related buttons into a single segmented control

Category: inputs · WCAG 2.2-AA · action, segmented, toolbar, layout

Sizes

States

Props

PropTypeDefaultDescription
orientation'horizontal' | 'vertical'horizontalLayout orientation of the component.
size'sm' | 'md' | 'lg'mdVisual size of the component (e.g. 'sm', 'md', 'lg').
rovingbooleanfalseWhen true, uses roving tabindex so arrow keys move focus between buttons.
loopbooleanfalseWhen true, navigation wraps around from end to start.
aria-labelstringAccessible label used when no visible label is present.
aria-labelledbystringId of the element that labels this component.

Design tokens

When to use

When not to use

How to build an accessible ButtonGroup in React →

Examples

Joined actions

<ButtonGroup aria-label="Text alignment"><Button>Left</Button><Button>Center</Button><Button>Right</Button></ButtonGroup>

Vertical with roving focus

<ButtonGroup orientation="vertical" roving aria-label="View"><Button>List</Button><Button>Grid</Button></ButtonGroup>

Related components

← Back to docs