Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Split Button

ProNew

A default action joined to a caret that lists its alternatives, with an optional description for each.

Installation

pnpm dlx shadcn@latest add @viewport/split-button

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
children*React.ReactNode

The label of the main action.

—
onClick() => void

Runs when the main part is pressed.

—
items*SplitButtonItem[]

The alternatives listed under the caret.

—
menuLabelstring

Accessible name of the caret button.

"More options"
variant"primary" | "outline""primary"
size"sm" | "md" | "lg""md"
loadingboolean

Puts the main action in its loading state. The menu stays available.

—
disabledboolean—
classNamestring—

Accessibility

  • Two separate buttons, each with its own name and focus ring.
  • The menu is a Radix Dropdown Menu: arrow keys, typeahead and Escape.
  • The main action can show a loading state while the menu stays available.
  • Respects prefers-reduced-motion.