Split Button
catnip-split-button is two native buttons in a labelled group, with popup semantics on the suffix button. You render the related action surface, and you own its role, labels, keyboard behaviour, and focus management.
Keyboard
- Both halves are native
<button>elements, withdisabledmapping directly. - The split button renders only the two buttons. Keyboard navigation inside the related action surface is yours.
Consumer-rendered menu
The live playground on the Split Button overview page includes a copyable snippet with full menu keyboard support for a catnip-list menu (see Consumer-rendered related actions):
| Key | Behaviour |
|---|---|
ArrowDown / Enter / Space on focused suffix | Open menu, highlight first enabled row |
ArrowDown / ArrowUp | Move active row (skip disabled) |
Home / End | First / last enabled row |
Enter / Space | Activate active row |
Escape | Close menu, return focus to suffix |
| Typeahead (a–z) | Jump to next label prefix match |
Screen readers
| Part | Semantics |
|---|---|
| Group | role="group" with an accessible aria-label describing the group. |
| Main button | Native <button> with the default-slot text. While loading, it has aria-busy="true" and both halves are natively disabled. |
| Suffix button | Native <button> named by ariaLabelSuffix ("More options" by default). Has aria-haspopup and aria-expanded when popup semantics are enabled; open drives aria-expanded. |
Visual
- Meet contrast requirements for text and icons on the button surface (WCAG AA).
What you own
- Main button name: Set
splitButtonAriaLabelwhen the main button is icon-only. - Popup state: Pass the controlled
openstate back to the split button, and keepopen,ariaControls, andariaHaspopupsynchronized with the surface you render. UseariaControlsto point to the consumer-rendered popup when it is visible. - Action surface: The consumer-rendered action surface should provide the appropriate role, labels, keyboard behaviour, and focus management for its pattern. When you use
catnip-listas the related action surface, wire the keyboard support in Consumer-rendered menu. - Closing: Close the consumer-rendered surface when the user chooses an item or clicks outside the split-button/menu region.