Skip to content

Button group

Expressive

Groups buttons as a unit; the connected variant replaces segmented buttons.

import { ButtonGroup } from '@windmorph/react';

Keyboard

Button group keyboard
KeyAction
Tab or Shift + TabMoves 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 RightMoves focus to the previous or next button, wrapping from one end to the other (the WAI-ARIA toolbar).Without selection, or with multiple selection
Home or EndMoves focus to the first or the last button.Without selection, or with multiple selection
Arrow Left or Arrow Right or Arrow Up or Arrow DownMoves 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
Home or EndSelects the first or the last option.Single selection
Enter or SpaceActivates 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
toolbar of buttons without selectionMode; radiogroup of radios with selectionMode="single"; toolbar of toggle buttons with selectionMode="multiple". Nested in another toolbar, the group becomes a group and the outer toolbar handles the arrow keys.
Accessible name
The group takes aria-label or aria-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, and aria-disabled on 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 secondary outline 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 Menu does.

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 own aria-label.
  • Pass labels to 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.