Xzero UI
Pro library

Split button

A primary action with a menu of nearby alternatives.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/split-button
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/split-button

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { SplitButton } from "@/components/xzero/split-button/split-button";

export function MergeButton() {
  return (
    <SplitButton
      label="Merge pull request"
      onClick={merge}
      actions={[
        { label: "Squash and merge", onSelect: squash },
        { label: "Rebase and merge", onSelect: rebase },
        { label: "Close pull request", onSelect: close, destructive: true },
      ]}
    />
  );
}

API reference

SplitButton

A primary action joined to a chevron that opens a Radix dropdown of related actions.

PropTypeDefaultDescription
label (required)string–Main action label. Changes morph letter by letter.
actions (required)SplitButtonAction[]–Menu items: { label, onSelect?, disabled?, destructive?, icon? }.
onClick() => void–Runs the main action.
iconReactNode–Leading icon on the main half. A different icon element crossfades in.
variant"primary" | "secondary""primary"Visual weight of both halves.
disabledboolean–Disables both the main action and the menu trigger.

Keyboard interactions

KeysAction
Enter / SpaceRuns the main action, or opens the menu from the chevron.
ArrowDown / ArrowUpMoves between menu items, looping at the ends.
EscapeCloses the menu and returns focus to the chevron.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in buttons

Guidance for AI tools

Split button: A primary action with a menu of nearby alternatives. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components