Skip to contentWolf-Rayet

Split button

A split button pairs a primary action with a menu of related actions.

Install

One package and one stylesheet. The stylesheet carries the tokens every component reads.

pnpm add @wolf-rayet/react
import '@wolf-rayet/react/css/wolf-rayet.css';
import { SplitButton } from '@wolf-rayet/react';

Props

A required prop is marked with an asterisk.

PropTypeDefaultDescription
children *ReactNode—Two buttons. The first is the main action and the second opens the alternatives.
appearance'default' | 'primary' | 'subtle' | 'warning' | 'danger' | 'discovery' | 'link''default'Applies to both halves, so they read as one control.
spacing'default' | 'compact'—Compact for a dense row.

Accessibility

What the component does for you, and what it needs from you.

  • The two halves are separate buttons, so each is reached and named on its own.
  • The second half needs a name saying what it opens, since it is an arrow with no words.
  • The divider between them is an inverse rule drawn over the bold ground, so it holds in both themes.