Floating button groupPro
The quiet tray under a message: a highlight that glides between buttons as a pill, underline or glow, and a tray that can hide when idle.
oxyn add floating-button-groupThe 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
Floating button group 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 floating-button-groupUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Floating
Raised tray, pill highlight.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Muted underline
Flat tray, underline highlight.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Glow labels
Labels on, glow highlight.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
FloatingButtonGroup
| Prop | Type | Default | Description |
|---|---|---|---|
itemsrequired | Vec<GroupItem> | — | Buttons. |
variant | String | "floating" | `muted` · `floating`. |
size | String | "md" | `sm` · `md`. |
vertical | bool | Default::default() | Vertical tray. |
icon_only | bool | true | Icons only with label tooltips. |
tooltip_side | String | "top" | Tooltip side. |
highlight_style | String | "pill" | `pill` · `underline` · `glow`. |
auto_hide | bool | Default::default() | Fade the tray out when idle. |
highlight | Option<usize> | Default::default() | Review sheets: force the highlight. |
on_action | EventHandler<String> | — | Pressed. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| Tab | Into the tray |
| Tab | Each button is a tab stop; focus moves the highlight |
Accessibility
- Icon-only buttons keep their labels as aria-label and tooltips.
- The gliding highlight is decorative (aria-hidden).
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
- vertical turns the tray into a side rail; tooltips move to tooltip_side.
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
FloatingButtonGroupfromoxyn_dioxusand includePRIMITIVES_CSSplus the token stylesheet once. - A GPUI version exists:
ButtonGroupElinoxyn_gpui. - Props to set first:
items. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.