Skip to contentKino
Skip to Content

Split button

A main action joined to a menu of the actions next to it. It is a Button group and a Dropdown menu, so it looks and moves as they do.

npx shadcn add https://kinoui.com/r/split-button.json
Share on

Examples

Q3 pricing review

Draft · edited 4 minutes ago by Priya Raman

The Team plan moves from $12 to $14 a seat on 1 October. Seats bought before then keep the old price for a year.

Finance team, 8 people

Default

Put a SplitButtonAction and a DropdownMenu holding a SplitButtonTrigger in a SplitButton. loading runs the action and holds both halves.

#1184 · Round invoice totals once, at the end

Priya Raman wants to merge 4 commits into main from fix/rounding
  • All 12 checks have passed
  • Approved byTATomás Alvarez
  • 4 files changed, +38 −12
The 4 commits become one on main.

Remember the last choice

The menu picks what the action does: keep the pick in state, show it on the action, and give the menu a DropdownMenuRadioGroup.

Variants

variant sets both halves at once, and the group draws the line between them in a shade of their colour.

Sizes

size sets both halves at once. The menu’s button stays square, as tall as the action.

Installation

npx shadcn@latest add https://kinoui.com/r/split-button.json
Files
lib/refs.tslib/reduce-motion.tslib/resize.tslib/swap.tsxcomponents/kino/spinner.tsxcomponents/kino/button.tsxlib/run-progress.tslib/highlight.tscomponents/kino/button-group.tsxlib/scroll.tscomponents/kino/separator.tsxlib/popup.tslib/menu.tsxcomponents/kino/dropdown-menu.tsxcomponents/kino/split-button.tsx
Packages
@base-ui/reactclass-variance-authority

New to Kino? Installation covers what your project needs first and the @kino namespace.

API reference

SplitButton

PropTypeDefaultDescription
variant'default''secondary''outline''destructive''default'The Button variant of both halves.
size'xs''sm''default''lg''default'The Button size of the action. The menu’s button is the square size to match.
loadingbooleanfalseThe action shows the Button’s spinner and blocks presses, and the menu’s button is disabled, neither of them dimmed.
disabledbooleanfalseDisables both halves. Either one can still take its own disabled.
aria-labelstringNoneWhat the action is, such as "Merge".

SplitButtonAction

PropTypeDefaultDescription
loadingbooleanfalseThe action alone is running, as a Copy button (opens in a new tab) is while it waits for its value: it holds the menu’s button too, as the group’s loading does.

SplitButtonTrigger

PropTypeDefaultDescription
aria-labelstringNoneRequired: what the menu holds, such as "Choose how to merge".
childrenReactNodeNoneAnother icon in place of the chevron.

Data attributes

AttributeOnDescription
data-popup-openSplitButtonTriggerPresent while its menu is open.
data-loadingBoth halvesPresent while the split button is loading.
data-glidedEach halfPresent on the half the highlight is under.

Accessibility

  • The group has role="group". Name it with aria-label, so a screen reader says what the action is for.
  • The menu’s button shows only an icon, so its aria-label is required and says what the menu holds.
  • Each half has its own place in the tab order. The menu opens with Enter, Space or Down arrow, the arrow keys move through it, and Escape closes it and puts focus back on its button.
  • While loading, the action keeps focus and is announced as busy, as a loading Button is.
  • When the system asks for less motion, the highlight moves straight to the other half and the menu only fades.