Button Group
ButtonGroup joins a set of related Buttons into one control.
<ButtonGroup aria-label="Range"> <Button>Day</Button> <Button>Week</Button> <Button>Month</Button></ButtonGroup>A ButtonGroup draws a few related Buttons as one control. The outer corners stay rounded, the inner corners become square, and a thin line separates each pair of buttons. Each button still works on its own.
Use a ButtonGroup for a small set of actions on the same thing, such as text styles or moving between pages. To let people pick one value from a set, use a SegmentedControl. For buttons that stay pressed, use a ToggleGroup, and for one main action with a menu of related ones, use a SplitButton.
Put Buttons directly inside the group. size on the group sets the size of every button that doesn't set its own, while tone, emphasis and bordered belong to each Button.
A ButtonGroup renders an element with role="group", so give it an aria-label that says what the buttons do together. Tab moves through the buttons one at a time. If you want the arrow keys to move between them instead, put the buttons in a Toolbar.
Props
Generated from the types. It lists what this component DECLARES: a prop that arrives from a shared type or from the platform is real and is not repeated here.
| Prop | Type | What it does |
|---|---|---|
size? | "1" | "2" | "3" | "4" | The size step of the buttons in the group, from 1 to 4. |
It also takes every prop of a <div>.