Split Button
SplitButton runs a common action from its label and opens the related actions from a chevron beside it.
<SplitButton menuLabel="More merge options" menu={<MenuItem>Squash and merge</MenuItem>}> Merge</SplitButton>A SplitButton pairs one common action with a few close alternatives. Pressing the label runs the common action, and pressing the chevron opens a Menu with the others. Use it when one choice is right most of the time, such as merge beside squash and merge or rebase and merge.
If no action is more common than the rest, put a Menu on a plain Button instead. If the actions aren't variants of one task, place separate Buttons in a Toolbar.
The two halves are real Buttons drawn as one box, so they share the same size, tone, emphasis and bordered values and look like a single control. Each half is still its own button, with its own focus stop. The menu opens under the whole button, lined up with its end edge.
The chevron half has no visible words, so you must name it with menuLabel. Screen readers announce that name along with the fact that the half opens a menu.
Props
Generated from the types. It lists what this component DECLARES: a prop that arrives from a shared type or from the platform is real and is not repeated here.
| Prop | Type | What it does |
|---|---|---|
backdrop? | boolean | Set backdrop when the button sits over other content, such as an image. |
bordered? | boolean | Adds a thin border. |
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
emphasis? | "loud" | "medium" | "quiet" | Sets how prominent the button is next to the buttons beside it. |
focusableWhenDisabled? | boolean | Keep focus on the button when it becomes disabled part-way through an interaction. |
leading? | React.ReactNode | Content before the label, usually an icon. |
loading? | boolean | Shows a spinner and blocks the press while an action runs. |
menu | React.ReactNode | The other actions: MenuItems, groups and separators, exactly what MenuContent holds. |
menuLabel | string | The chevron half's name. |
size? | "1" | "2" | "3" | "4" | Sets the size step of the button, from 1 to 4. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
tone? | "neutral" | "accent" | "destructive" | "blue" | "green" | "orange" | "amber" | "pink" | "purple" | "success" | "warning" | "info" | Sets what the action means, and the theme picks the colour. |
It also takes every prop of a <button>.