Split button
ExpressiveA primary action beside a trailing button that opens a menu of related actions.
import { SplitButton } from '@windmorph/react';Props
SplitButton 24 props
The M3 style of both buttons: filled, tonal, outlined or elevated.
Height, padding and label size of both buttons, from extra small to extra large.
Icon before the label, or on its own with
leadingLabel. Hidden from assistive tech.Ref to the trailing button, e.g. to anchor a custom overlay to it.
Whether the trailing button's menu or overlay is open (controlled).
Whether the menu starts open (uncontrolled).
Disables both buttons.
The leading button's label.
Accessible name of an icon-only leading button.
The leading button's
type, e.g.submitto send the form it's in.Ref to the root element.
The leading link's
rel, e.g.noopener.Makes the leading button a link (
<a>) to this URL.The leading link's
target, e.g._blank.
Events
Called when the trailing button is pressed. Without a menu or trigger it also toggles
open.Called with the new state when the menu or overlay opens or closes.
Text
Words the split button announces, with English defaults. A
LabelsProvidersets them for the whole app.
Classes for each part, by slot.
classNames.rootis merged withclassName.The group holding both buttons; merged with
className.The leading (main action) button.
Inner wrapper of the leading button, around its icon and label.
The leading button's label text.
The leading button's icon.
The trailing (menu) button.
Inner wrapper of the trailing button, around its icon.
Inline styles for the root element.
Classes for the root element, merged with the component's own (yours win).
Handler that is called when the press is released over the target.
Handler that is called when a press interaction starts.
Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target.
Also accepts the root element's HTML attributes (id, data-*, event handlers).
Tokens
M3's component tokens as CSS variables. Each is unset until you set it, on :root, a theme or any ancestor, and falls back to the default shown. The root carries data-variant (and data-size where it has sizes), which picks the variables that apply. See Component tokens in the Customisation guide.
| Variable | Default | Paints | Compose |
|---|---|---|---|
| Xs (size) | |||
--md-comp-split-button-xsmall-container-shape | var(--md-sys-shape-corner-full) | The outer corners of both halves: full, at most half the height. | SplitButtonXSmallTokens.ContainerShape |
| Sm (size) | |||
--md-comp-split-button-small-container-shape | var(--md-sys-shape-corner-full) | The outer corners of both halves: full, at most half the height. | SplitButtonSmallTokens.ContainerShape |
| Md (size) | |||
--md-comp-split-button-medium-container-shape | var(--md-sys-shape-corner-full) | The outer corners of both halves: full, at most half the height. | SplitButtonMediumTokens.ContainerShape |
| Lg (size) | |||
--md-comp-split-button-large-container-shape | var(--md-sys-shape-corner-full) | The outer corners of both halves: full, at most half the height. | SplitButtonLargeTokens.ContainerShape |
| Xl (size) | |||
--md-comp-split-button-xlarge-container-shape | var(--md-sys-shape-corner-full) | The outer corners of both halves: full, at most half the height. | SplitButtonXLargeTokens.ContainerShape |
Spec status
Built to the M3 Expressive split button spec. Each item of its variants and configurations links to a live example; where the M3 Expressive column of the spec differs from the original M3 one, it wins.
| Item | Status | Details |
|---|---|---|
| Split button | Built | Variant · Basic |
| Color: elevated, filled, tonal, outlined | Built | Configuration · Variants |
| Size: XS, S, M, L, XL | Built | Configuration · Sizes |
| Leading button: label and icon, label, or icon | Built | Use case · Basic, Sizes, Icon |
| Links | Extension | href makes the leading button a link. |
| Custom overlays | Extension | Without menu, the trailing button joins an enclosing DialogTrigger, SheetTrigger or RichTooltipTrigger, or calls onTrailingPress with trailingRef to anchor an overlay of your own. |
Split button
BuiltVariant · Basic
Color: elevated, filled, tonal, outlined
BuiltConfiguration · Variants
Size: XS, S, M, L, XL
BuiltConfiguration · Sizes
Links
Extensionhrefmakes the leading button a link.Custom overlays
ExtensionWithout
menu, the trailing button joins an enclosingDialogTrigger,SheetTriggerorRichTooltipTrigger, or callsonTrailingPresswithtrailingRefto anchor an overlay of your own.
Bundle size
Gzipped, as published: the component and the library code it imports. React, React Aria, Motion and the other dependencies aren't counted, and your bundler's minifier makes it smaller still. CI fails a change that grows it past its budget.
SplitButton: 18.9 kB
M3 Expressive specs
- Sizes
xs, sm, md, lg, xl- Variants
filled, elevated, tonal, outlined
Differences from Compose
- Variants are
filled | tonal | outlined | elevated— Compose has no text split button. Sizes runxs–xl; colours and elevation are shared with Button. - The two halves sit 2px apart, each at least 48px wide, with full outer corners. Inner corners are 4 / 4 / 4 / 8 / 12px and change to 8 / 12 / 12 / 20 / 20px when hovered, keyboard-focused or pressed (Compose uses only the pressed tokens). The menu opens 4px below, aligned with the trailing button's end edge, even against the edge of the window (the menu's
containerPaddingis 0). - With a mouse the menu opens when the press is released, not on pointer down as React Aria's menu triggers do, so the trailing button's pressed shape shows while it's held. Keyboard and touch are unchanged.
- Under reduced motion the chevron turns and the corners change without animating.
- While its menu is open the trailing button becomes a circle with a persistent 10% layer of its content colour, drawn by its state layer and added to any hover or focus layer.
- The chevron turns over inwards (towards the leading button) on the standard scheme's fast spatial spring, whatever the active scheme, as the spec asks. At rest it sits −1 / −1 / −2 / −3 / −6px from the centre, a logical offset that mirrors in RTL, and it can't be replaced.
- The per-size asymmetric corners and optical offset are not expressible through the public
Button/IconButton, so the halves build onButtonBase; the leading half is shielded from the menu's trigger context.