Split buttonPro
A main action with a menu of alternatives; it can remember the last choice and promote it to the main half.
oxyn add split-buttonThe preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.
Rendered from Rust at build time · goes live when visible
When to use
- Agent UIs keep several related actions in a small space: the answer toolbar (copy, regenerate, good / bad, share), merge options on a PR card, formatting in an editor, model choice next to Run.
- Groups make them one object with one highlight, so the pointer reads as a single soft shape moving over the row instead of buttons flickering on and off.
When not to use
- Actions and choices behind any trigger: use Dropdown Menu instead.
- Switch between two to six options: use Segmented Control instead.
- A small label for one control: use Tooltip instead.
Installation
Split button is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.
oxyn add split-buttonUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Primary
Merge with alternatives.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Secondary
Quieter, next to a primary.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Open
Menu open.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
SplitButton
| Prop | Type | Default | Description |
|---|---|---|---|
actionsrequired | Vec<(String, String)> | — | Actions `(id, label)`; the first is the default main action. |
variant | String | "primary" | `primary` · `secondary`. |
icon | Option<String> | Default::default() | Main icon. |
disabled | bool | Default::default() | Disabled. |
remember | bool | Default::default() | Promote the last chosen alternative to the main half. |
open | bool | Default::default() | Start open (review sheets). |
on_action | EventHandler<String> | — | An action ran. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| EnterorSpace | Main action |
| ↓or↑ on the arrow | Open the menu on the first or last item |
| Esc | Close the menu, focus back on the arrow |
Accessibility
- Two real buttons; the arrow has aria-haspopup=menu and aria-expanded.
- The menu is a role=menu with roving focus.
From the spec
- Group:
role=group(toolbars:role=toolbar) witharia-orientation; one tab stop, arrow keys inside. Icon-only segments carryaria-labeland a tooltip. - Toggle segments expose
aria-pressed. The overflow trigger isaria-haspopup=menu+aria-expanded. - Split: the ▾ is a separate button named "More actions"; Esc returns focus to it.
- Expanding: every button is named by its label even while collapsed; the done label is announced once through a polite live region.
Motion & interaction
- One highlight lives under all segments (Arc): moving the pointer carries it on
spring.snap; keyboard moves jump. Appearing from nothing it grows in from 94 % instead of sliding from where it last was. The dividers next to it fade so it reads as one shape inside the joined surface. - Pressed segment answers in place (scale 0.96) without moving the highlight.
- Split button: the main half's label and icon morph in place while its width springs; the ▾ half never scales, so the menu opens from a still anchor; menu rows fade in with a 20 ms stagger. The chevron turns half a circle while open.
- Expanding: width springs between icon size and icon + measured label (Arc
morph, 420 ms); the label fades in after the width starts; confirmation swaps the icon for a check.
Timing
| Transition | Duration | Delay | Easing / spring | Stagger |
|---|---|---|---|---|
| Highlight glide | 214 ms (spring.snap) | 0 | spring | — |
| Highlight appear | 214 ms, scale 0.94 → 1, fade | 0 | ease.out | — |
| Divider fade | 120 ms | 0 | ease.out | — |
| Segment press | 80 ms, 0.96 | 0 | ease.out | — |
| Split label morph | 180 ms crossfade + width spring.snap | 0 | ease.out | — |
| Split menu open | 180 ms fade (anchor still) | 0 | ease.out | rows 20 ms |
| Floating tooltip | instant within the group (neighbour rule) | 0 | — | — |
| Auto-hide | 300 ms fade to 35 % | 3 s idle | ease.out | — |
| Expand width | 420 ms (Arc morph) | delay_ms (Oxyn plus, default 0) | ease.out | — |
| Confirm hold | 1400 ms (confirmDuration) | — | — | — |
| Reduced motion | highlight jumps (80 ms fade); no press scale; widths change in 80 ms; no stagger | — | linear | none |
Responsive behaviour
- The menu opens below and aligns to the button's start edge.
Edge cases (spec)
- Disabled segments are skipped by arrows and never take the highlight.
- Highlight target removed (overflow recomputed): the highlight hides instead of pointing at nothing; the next hover makes it appear in place.
- Narrow containers:
fit()keeps as many segments as fit beside the overflow button. - Vertical groups: dividers become horizontal; arrows switch axis.
- Long done labels in the expanding group widen the reserved slot once, at mount.
- Touch: no hover; the floating group shows labels on long-press via the tooltip.
- Split button with one action renders the main half only (no menu).
Notes for AI
- Import
SplitButtonfromoxyn_dioxusand includePRIMITIVES_CSSplus the token stylesheet once. - A GPUI version exists:
SplitButtonElinoxyn_gpui. - Props to set first:
actions. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.