Takeoff Split Button
ASecurity`SplitButton` joins a main action to a menu toggle that opens related secondary actions. The halves are drawn by `Button`; the menu is `Dropdown`'s (same items, keyboard model and look). Behavior is Spar's `Button` and `DropdownMenu`. **When to use:** one action is the common choice and a few alternatives belong next to it (save / save as, merge methods, export formats). Not this — a menu with no main action is `Dropdown`; two equally important actions are two `Button`s; a choice between view...
- 3 stars
- 0 votes
- 0 copies
- 2 views
- Added December 4, 2026
Works with
Security analysis
100/100Pro scans all 2 files and shows the line behind each finding
npx -y skills add turkishtechnology/takeoff-v2 --skill takeoff-split-button --agent claude-codeAre you the author of Takeoff Split Button?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/turkishtechnology-takeoff-split-button)---
name: takeoff-split-button
description:
'Build a SplitButton (a main action button joined to a chevron toggle that
opens a menu of related actions) — the SplitButton from @takeoff-ui/react-spar
(Takeoff UI / Spar React). Trigger when a button needs alternative actions
("Save" + "Save as draft", "Merge" + "Squash and merge", "Check in" + "Email
boarding pass"), when building a "button with a dropdown arrow", or replacing
a hand-made Button + Dropdown pair. Use this skill WHENEVER building, adding,
importing, styling, or fixing a SplitButton in a React app that uses
@takeoff-ui/react-spar / Takeoff / Spar. Not for a menu with no main action —
use Dropdown there.'
---
# SplitButton — @takeoff-ui/react-spar
`SplitButton` joins a main action to a menu toggle that opens related secondary
actions. The halves are drawn by `Button`; the menu is `Dropdown`'s (same items,
keyboard model and look). Behavior is Spar's `Button` and `DropdownMenu`.
**When to use:** one action is the common choice and a few alternatives belong
next to it (save / save as, merge methods, export formats). Not this — a menu
with no main action is `Dropdown`; two equally important actions are two
`Button`s; a choice between views is `ToggleButtonGroup`.
## Setup
Requires the Takeoff provider + token CSS mounted once at the app root (see the
`takeoff-ui` skill or the installation docs). Then import:
```tsx
import { SplitButton } from '@takeoff-ui/react-spar';
```
## Compound parts
- `SplitButton` — root `role="group"` (polymorphic `div`). Holds the visuals
(`variant`, `appearance`, `size`, `type`), `disabled`, `triggerLabel` and the
menu state (`open` / `defaultOpen` / `onOpenChange`, `modal`,
`closeOnSelect`). Name it with `aria-label`.
- `SplitButton.Action` — the main action, a Takeoff `Button` (`startContent`,
`endContent`, `loading`, `disabled`, `onClick`, `as`). Children are the label.
- `SplitButton.Trigger` — the icon-only menu toggle. Children replace the
default chevron glyph; `disabled` disables only the menu.
- `SplitButton.Content` — the menu panel (`role="menu"`, labelled by the
toggle). `align` defaults to `end`.
- `SplitButton.Item` / `.Group` / `.Label` / `.Separator` / `.Viewport` — these
**are** `Dropdown.Item` / `.Group` / `.Label` / `.Separator` / `.Viewport`
(same props, `tk-dropdown-*` classes and theme keys).
## Basic usage
```tsx
<SplitButton aria-label="Save options">
<SplitButton.Action startContent={<SaveIcon />} onClick={save}>
Save
</SplitButton.Action>
<SplitButton.Trigger />
<SplitButton.Content>
<SplitButton.Item onSelect={saveDraft}>Save as draft</SplitButton.Item>
<SplitButton.Item onSelect={saveTemplate}>
Save as template
</SplitButton.Item>
</SplitButton.Content>
</SplitButton>
```
## Examples
### Combination type, appearance and size
```tsx
<SplitButton
type="relaxed"
variant="secondary"
appearance="outlined"
size="small"
aria-label="Export"
>
<SplitButton.Action>Export PDF</SplitButton.Action>
<SplitButton.Trigger />
<SplitButton.Content>
<SplitButton.Item>Export CSV</SplitButton.Item>
</SplitButton.Content>
</SplitButton>
```
### Remember the last choice
Note: `import { useState } from 'react';`
```tsx
const [method, setMethod] = useState(methods[0]);
<SplitButton aria-label="Merge options" triggerLabel="Choose a merge method">
<SplitButton.Action onClick={() => merge(method.value)}>
{method.label}
</SplitButton.Action>
<SplitButton.Trigger />
<SplitButton.Content>
{methods.map(m => (
<SplitButton.Item key={m.value} onSelect={() => setMethod(m)}>
{m.label}
</SplitButton.Item>
))}
</SplitButton.Content>
</SplitButton>;
```
### Disable one half, or show progress
```tsx
<SplitButton aria-label="Publish">
<SplitButton.Action loading={isPublishing}>Publish</SplitButton.Action>
<SplitButton.Trigger disabled={!canSchedule} />
<SplitButton.Content>
<SplitButton.Item>Schedule…</SplitButton.Item>
</SplitButton.Content>
</SplitButton>
```
## Key props
### `SplitButton` (root)
| Prop | Type | Default | Notes |
| --------------- | -------------------------------------------- | ---------------- | --------------------------------------------------------- |
| `variant` | `'primary' \| 'secondary' \| 'neutral' \| …` | `'primary'` | Button's palette; the design uses the first three. |
| `appearance` | `'filled' \| 'outlined' \| 'filledLight'` | `'filled'` | Shared by both halves. |
| `size` | `'small' \| 'base' \| 'large'` | `'base'` | Halves and menu. |
| `type` | `'basic' \| 'divided' \| 'relaxed'` | `'basic'` | Joined with a line / joined with a 2px gap / 4px apart. |
| `disabled` | `boolean` | `false` | Disables both halves. |
| `triggerLabel` | `string` | `'More options'` | Toggle's accessible name; `''` falls back to the default. |
| `open` | `boolean` | - | Controlled open state. |
| `defaultOpen` | `boolean` | `false` | Uncontrolled initial state. |
| `onOpenChange` | `(open: boolean) => void` | - | Fires on open and close. |
| `modal` | `boolean` | `true` | Keeps focus inside the open menu. |
| `closeOnSelect` | `boolean` | `true` | Close after an item is selected. |
### `SplitButton.Content`
| Prop | Type | Default | Notes |
| ------------------------------------------------------------- | ---------------------------------------- | ---------- | --------------------------------------- |
| `side` | `'top' \| 'right' \| 'bottom' \| 'left'` | `'bottom'` | Side of the toggle the panel opens on. |
| `align` | `'start' \| 'center' \| 'end'` | `'end'` | Lines the panel up with the group end. |
| `sideOffset` | `number` | `8` | Distance in px from the toggle. |
| `container` | `HTMLElement \| null` | body | Portal container. |
| `onEscapeKeyDown` / `onPointerDownOutside` / `onFocusOutside` | event callbacks | - | `preventDefault()` keeps the menu open. |
Items: `disabled`, `onSelect(event)` (`preventDefault()` keeps the menu open),
`textValue` (typeahead text for non-text children) — Dropdown's.
Full props, events, data attributes & type definitions: see
`references/full-docs.md`.
## Accessibility
- The root is `role="group"`: give it an `aria-label` (or `aria-labelledby`).
- Two tab stops: the action, then the toggle. The toggle is icon-only and named
by `triggerLabel` (default "More options"); translate it per locale.
- The toggle carries `aria-haspopup="menu"`, `aria-expanded` and
`aria-controls`; the panel is `role="menu"` labelled by the toggle.
- `↓`/`↑` on the toggle open onto the first / last item; in the menu they move
and wrap, `Home` / `End` jump, `Enter` / `Space` select, typing jumps by
typeahead, `Esc` closes and returns focus to the toggle.
## Reference
- Full component docs (Copy page): `references/full-docs.md`
- Live docs: https://v2.takeoffui.com/docs/components/split-button
- Source: `packages/react-spar/src/components/split-button/`
- Spar primitive: https://v2.takeoffui.com/headless/docs/Components/DropdownMenu
Files in this skill
- SKILL.md
- references/full-docs.md
Attribution
Related skills
View all in design →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.