---
title: "Split Button"
description: "A button with the main action in front and its close variants behind a small arrow. The last pick from the menu becomes the main action."
url: https://gelatinui.com/components/split-button
markdown_url: https://gelatinui.com/components/split-button.md
access: free
install: "npx shadcn@latest add @gelatin-ui/split-button"
registry_item: https://gelatinui.com/r/split-button.json
version: "2026-11-17"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Split Button

> A button with the main action in front and its close variants behind a small arrow. The last pick from the menu becomes the main action.

Page: https://gelatinui.com/components/split-button

## When to use it

Best for: One main action with a few close variants, where the last pick should become the new main action.

- Use it when one action is used most and 2 to 6 close variants of it are used less.
- Use `SplitButtonOptions` when the user picks a way once and repeats it, such as a merge method.
- Return a promise from `onAction` to show the busy state, then the done check for 1.2 s.

## When not to use it

- For actions that are not variants of one main action, use a [Menu](https://gelatinui.com/components/menu.md).
- For two or three equal actions side by side, use a [Button Group](https://gelatinui.com/components/button-group.md).
- For one risky action that needs a confirm step, use a [Hold Button](https://gelatinui.com/components/hold-button.md).

## Notes for agents

- Give the root an `aria-label` that names the group, and give `SplitButtonTrigger` its own `aria-label`.
- Save `value` from `onValueChange` per user, and pass it back as `value` or `defaultValue`, to remember the last pick.
- A rejected `onAction` promise shows an error Toast: render a `Toaster` in the app.
- `tone="destructive"` wins over `variant`. Sizes: `xs`, `sm`, `default`, `lg`.
- A long label truncates only when the action has a `max-w-*` class.

## Anatomy

```text
SplitButton
├─ SplitButtonAction (0..n)
├─ SplitButtonTrigger (0..n)
├─ SplitButtonContent (0..n)
├─ SplitButtonOptions (0..n)
├─ SplitButtonOption (0..n)
├─ SplitButtonOptionLabel (0..n)
└─ SplitButtonOptionDescription (0..n)
```

## API reference

### SplitButton

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `variant` | `"default" \| "outline" \| "secondary"` | "default" | The look of both parts. Default `default`. |
| `tone` | `"destructive"` |  | `destructive`: the soft red look of a risky action (Delete 3 files). Wins over `variant`. |
| `size` | `"default" \| "lg" \| "sm" \| "xs"` | "default" | The row size of both parts. Default `default` (32px). |
| `value` | `string` |  | The main action now: the value of the `SplitButtonOption` that the last pick made the main one. The app saves it (per user, per page) to remember the last pick. |
| `defaultValue` | `string` |  |  |
| `onValueChange` | `function` |  |  |
| `open` | `boolean` |  | The menu is open (controlled), with `defaultOpen` and `onOpenChange`. |
| `defaultOpen` | `boolean` | false |  |
| `onOpenChange` | `function` |  |  |
| `onAction` | `function` |  | Runs on a press of the action, with the main value. A promise shows the action busy (spinner, no second run, the arrow off), then done for 1.2 s; a rejection shows an error Toast. |
| `labels` | `Partial<typeof SPLIT_BUTTON_LABELS>` |  |  |

### SplitButtonAction

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `children` | `function \| ReactNode` |  | The words of the main action. A function gets the main `value` and the `status`, so the label can follow the last pick and say "Publishing" and "Published". |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### SplitButtonTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `aria-label` | `string` |  | Defines a string value that labels the current element. Name the menu: "More ways to publish". The arrow has no text of its own. |
| `className` | `string` |  |  |
| `children` | `ReactNode` |  |  |

Also takes every prop of Base UI `Menu.Trigger`: https://base-ui.com/react/components/menu

### SplitButtonContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `arrow` | `boolean` |  | Show an arrow that points at the trigger. The gap grows from 4px to 8px. |
| `backdrop` | `boolean` |  | Put a clear layer under the popup (Base UI `Menu.Backdrop`), for example to dim it. |
| `portalProps` | `Omit` |  | Other Base UI props of the inner parts. A `className` here adds to the component classes. |
| `positionerProps` | `PopupPartProps` |  |  |
| `backdropProps` | `PopupPartProps<MenuBackdropProps>` |  |  |
| `arrowProps` | `PopupPartProps<MenuArrowProps>` |  |  |

Also takes every prop of Base UI `Menu.Popup`: https://base-ui.com/react/components/menu

### SplitButtonOptions

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Menu.RadioGroup`: https://base-ui.com/react/components/menu

### SplitButtonOption

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `value` | `string` |  |  |

Also takes every prop of Base UI `Menu.RadioItem`: https://base-ui.com/react/components/menu

### SplitButtonOptionLabel

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### SplitButtonOptionDescription

No props of its own: `className`, `children`, and every other prop go to the element it renders.

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| SplitButton | `split-button` |  |  |  |
| SplitButtonAction | `split-button-action` |  |  |  |
| SplitButtonTrigger | `split-button-trigger` |  |  |  |
| SplitButtonContent | `split-button-content` |  |  |  |
| SplitButtonOptions | `split-button-options` |  |  |  |
| SplitButtonOption | `split-button-option` |  |  |  |
| SplitButtonOptionLabel | `split-button-option-label` |  |  |  |
| SplitButtonOptionDescription | `split-button-option-description` |  |  |  |

## Usage

Put the main action, its arrow, and the menu in `SplitButton`. A `SplitButtonOption` pick becomes the main action; a plain `MenuItem` runs once.

```tsx title="merge-button.tsx"
import { MenuItem } from "@/components/ui/menu";
import {
  SplitButton,
  SplitButtonAction,
  SplitButtonContent,
  SplitButtonOption,
  SplitButtonOptionDescription,
  SplitButtonOptionLabel,
  SplitButtonOptions,
  SplitButtonTrigger,
} from "@/components/actions/split-button";

export function MergeButton({ onMerge }: { onMerge: (method?: string) => Promise<void> }) {
  return (
    <SplitButton aria-label="Merge" defaultValue="squash" onAction={onMerge}>
      <SplitButtonAction>
        {({ value, status }) => {
          if (status === "pending") return "Merging";
          return value === "rebase" ? "Rebase and merge" : "Squash and merge";
        }}
      </SplitButtonAction>
      <SplitButtonTrigger aria-label="More ways to merge" />
      <SplitButtonContent>
        <SplitButtonOptions>
          <SplitButtonOption value="squash">
            <SplitButtonOptionLabel>
              Squash and merge
              <SplitButtonOptionDescription>One commit on main</SplitButtonOptionDescription>
            </SplitButtonOptionLabel>
          </SplitButtonOption>
          <SplitButtonOption value="rebase">
            <SplitButtonOptionLabel>Rebase and merge</SplitButtonOptionLabel>
          </SplitButtonOption>
        </SplitButtonOptions>
        <MenuItem>Copy branch name</MenuItem>
      </SplitButtonContent>
    </SplitButton>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/split-button
```

It adds 57 registry items: 54 files, 8606 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@phosphor-icons/react`, `@xstate/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## Built on

- [Button](https://gelatinui.com/components/button.md)
- [Button Group](https://gelatinui.com/components/button-group.md)
- [Collapsible](https://gelatinui.com/components/collapsible.md)
- [Menu](https://gelatinui.com/components/menu.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Button Group](https://gelatinui.com/components/button-group.md)
- [Button](https://gelatinui.com/components/button.md)
- [Menu](https://gelatinui.com/components/menu.md)
- [Hold Button](https://gelatinui.com/components/hold-button.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Moves focus from the action to the arrow: the group has two tab stops. |
| Enter, Space | On the action: runs it. On the arrow: opens the menu. |
| Alt+ArrowDown | On the action or the arrow: opens the menu. |
| ArrowUp, ArrowDown, Home, End | In the menu: moves between the items. |
| Escape | Closes the menu and moves focus back to the arrow. |

## Motion

| Part | Motion |
| --- | --- |
| Label swap | fade · 150ms · the old label rises and blurs out, the new one rises in, and the box glides to its width |
| Busy | animate-spin · a spinner takes the leading slot while the label stays |
| Menu | popup · the menu opens from the arrow, and the chevron turns 180° |
