Button group
ExpressiveGroups buttons as a unit; the connected variant replaces segmented buttons.
import { ButtonGroup } from '@windmorph/react';Keyboard
| Key | Action | Where |
|---|---|---|
| Tab or Shift + Tab | Moves focus into the group (back to the button focused last, when there is one; to the selected button in a single-selection group), and out of it in one step. | |
| Arrow Left or Arrow Right | Moves focus to the previous or next button, wrapping from one end to the other (the WAI-ARIA toolbar).Without selection, or with multiple selection | Without selection, or with multiple selection |
| Home or End | Moves focus to the first or the last button.Without selection, or with multiple selection | Without selection, or with multiple selection |
| Arrow Left or Arrow Right or Arrow Up or Arrow Down | Moves to the previous or next option and selects it, wrapping from one end to the other (the WAI-ARIA radio group its radiogroup role announces, as RadioGroup does). The overflow button is on the same path, and is focused without being selected.Single selection | Single selection |
| Home or End | Selects the first or the last option.Single selection | Single selection |
| Enter or Space | Activates the focused button, selects the focused option in a single-selection group, or toggles it in a multiple-selection group. |
- The arrow keys follow the laid-out direction, so they are mirrored in right-to-left layouts.
- In a multiple-selection group the arrow keys only move focus; Enter or Space toggles. In a single-selection group selection follows focus, as screen reader users expect of radio buttons (2026-10-15; M3 lists the arrows as moving focus for every group).
- Disabled buttons, and buttons folded into the overflow menu, are skipped.
Screen reader
- Role
toolbarof buttons withoutselectionMode;radiogroupofradios withselectionMode="single";toolbarof toggle buttons withselectionMode="multiple". Nested in another toolbar, the group becomes agroupand the outer toolbar handles the arrow keys.- Accessible name
- The group takes
aria-labeloraria-labelledby; each button keeps its own name. - States announced
- Checked or not checked (
aria-checked) for each radio, pressed or not pressed (aria-pressed) for each multiple-selection toggle, andaria-disabledon a disabled group.
With overflow, the trailing "More options" icon button (labels.more) opens a Menu of the folded buttons, named by their labels: actions as menuitems, toggles as menuitemcheckboxes (menuitemradios in a single-selection group), showing their state, and disabled buttons disabled.
Focus
- The group is one Tab stop; the arrow keys move between its buttons, and focus comes back to the last focused button when Tab re-enters, or to the selected one in a single-selection group.
- Each button shows M3's focus indicator under keyboard focus: a 3px
secondaryoutline 2px outside it. - The overflow menu takes focus when it opens and gives it back to the "More options" button when it closes, as any
Menudoes.
Touch target
- Extra-small and small buttons keep their invisible 48 × 48px touch targets. A standard group spaces them 18px (XS) and 12px (S) apart, and narrow icon buttons 48px minus their width (20px at XS, 16px at S), so the targets of neighbours never overlap.
- In a connected group, extra-small and small icon buttons are at least 48px wide; buttons sit 2px apart at every size.
- A group follows the density of the icon buttons inside (the theme's or a
ThemeScope's): they get smaller and keep their 48px targets, and the XS and S gaps grow as they shrink, so neighbouring targets meet but never overlap.
Motion
Under reduced motion a pressed button doesn't grow into its neighbours' space, and the press and selection morphs snap to their new corners. Colours still fade.
What you need to do
- Name the group with
aria-label(for example "Calendar view" or "Text formatting"), and give icon buttons in it their ownaria-label. - Pass
labelsto translate "More options". - With
overflow, put the actions in order of importance: the trailing ones are folded first. - Use a connected group for selection, with toggle buttons that have a
value, and a standard group for actions.