Split button
ExpressiveA primary action beside a trailing button that opens a menu of related actions.
import { SplitButton } from '@windmorph/react';Keyboard
| Key | Action | Where |
|---|---|---|
| Tab or Shift + Tab | Moves focus to the leading button, then to the trailing button, then on. | |
| Enter or Space | Runs the leading action, or follows it when it has href.On the leading button | On the leading button |
| Enter or Space or Arrow Down | Opens the menu with focus on its first item.On the trailing button | On the trailing button |
| Arrow Up | Opens the menu with focus on its last item.On the trailing button | On the trailing button |
| Arrow Up or Arrow Down or Enter or Escape | Work as in any Menu: the arrows move between items, Enter chooses one, and Escape closes the menu.In the menu | In the menu |
Screen reader
- Role
- A
groupof twobuttons side by side (the leading one is alinkwithhref). The trailing button opens amenu. - Accessible name
- The leading button is named by its label, or by
leadingLabelwhen it shows only an icon. The trailing button is named bylabels.menu("More options" by default; name it for its menu, as in "More send options"), and the menu is named after it. - States announced
- The trailing button reports
aria-haspopupandaria-expandedwith a menu,aria-expandedalone when it opens its own overlay, and both halves report disabled.
- The leading icon and the chevron are hidden from assistive tech (
aria-hidden). - While the menu is open, the rest of the page, the split button included, is hidden from assistive tech.
Focus
- Both halves are separate Tab stops, leading first.
- Keyboard focus shows M3's focus indicator on the focused half: a 3px
secondaryoutline 2px outside it. Pointer presses show no ring. - The menu takes focus when it opens and gives it back to the trailing button when it closes, as any
Menudoes. A mouse press opens the menu on release and focuses the trailing button first, so focus still returns there.
Touch target
- Medium, large and extra-large split buttons (56, 96 and 136px tall) are taller than 48px.
- At extra-small and small (32 and 40px tall), each half gets its own invisible 48px-tall touch target, at least 48px wide; their layout height stays the same.
Motion
Under reduced motion the press and open morphs snap to their new corners, the chevron turns over at once instead of rotating, and the press ripple appears at full size without growing. Colours still fade.
What you need to do
- Give
labels.menua name that ties the menu to the main action: "More send options" beside "Send", not "More". - Pass
leadingLabelwhen the leading button shows only an icon. - Name the group with
aria-labelonly when its buttons need context they lack; it reads as a group of the two either way. - Keep the menu to actions related to the leading one.