Skip to content
Back

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-button
The code is part of Oxyn Pro

The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.

Get Pro

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

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.

Terminal
oxyn add split-button

Usage

Dioxus · rust
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Examples

Primary

Merge with alternatives.

Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Secondary

Quieter, next to a primary.

Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Open

Menu open.

Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

API reference

SplitButton

PropTypeDefaultDescription
actionsrequiredVec<(String, String)>—Actions `(id, label)`; the first is the default main action.
variantString"primary"`primary` · `secondary`.
iconOption<String>Default::default()Main icon.
disabledboolDefault::default()Disabled.
rememberboolDefault::default()Promote the last chosen alternative to the main half.
openboolDefault::default()Start open (review sheets).
on_actionEventHandler<String>—An action ran.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
EnterorSpaceMain action
↓or↑ on the arrowOpen the menu on the first or last item
EscClose 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) with aria-orientation; one tab stop, arrow keys inside. Icon-only segments carry aria-label and a tooltip.
  • Toggle segments expose aria-pressed. The overflow trigger is aria-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
TransitionDurationDelayEasing / springStagger
Highlight glide214 ms (spring.snap)0spring—
Highlight appear214 ms, scale 0.94 → 1, fade0ease.out—
Divider fade120 ms0ease.out—
Segment press80 ms, 0.960ease.out—
Split label morph180 ms crossfade + width spring.snap0ease.out—
Split menu open180 ms fade (anchor still)0ease.outrows 20 ms
Floating tooltipinstant within the group (neighbour rule)0——
Auto-hide300 ms fade to 35 %3 s idleease.out—
Expand width420 ms (Arc morph)delay_ms (Oxyn plus, default 0)ease.out—
Confirm hold1400 ms (confirmDuration)———
Reduced motionhighlight jumps (80 ms fade); no press scale; widths change in 80 ms; no stagger—linearnone

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 SplitButton from oxyn_dioxus and include PRIMITIVES_CSS plus the token stylesheet once.
  • A GPUI version exists: SplitButtonEl in oxyn_gpui.
  • Props to set first: actions.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI