Skip to content
Back

Action statesPro

An action label that swaps to its next state while keeping its place: a working phase (pending label or a round spinner), a failure label, tones, and holds that advance on their own.

oxyn add action-states
Enter or Space advances
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

  • A button whose label swaps to its next state while keeping its place (Follow → Following).
  • Each state has a label, tone (neutral, accent, success, warning, quiet), icon, an optional pending label and an optional hold that advances on its own.
  • A press either advances or starts a working phase: the next state's pending label, or the pill folds into a round spinner for at least 450 ms; a failed action shows the failure label (“Try again”) for 1.8 s and stays.
  • Labels morph letter by letter; a success icon wipes in.

When not to use

  • A pill that confirms by splitting: use Split confirm instead.
  • A Give to your agent split button: use Agent prompt copy instead.
  • Eight variants and five sizes, with a shimmering loading state, a progress fill, press-and-hold for destructive actions and a shortcut chip: use Button instead.

Installation

Action states 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 action-states

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

Follow

Folds into a round spinner while it works.

Enter or Space advances
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

Copy

Copied holds 1.5 s, then returns.

Enter or Space advances
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

Deploy

Pending labels and tones.

Enter or Space advances
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

Fails

A failed action shows Try again for 1.8 s.

Enter or Space advances
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

StatefulActionButton

PropTypeDefaultDescription
modelrequiredStatefulAction—Model.
sizeString"md"`sm` · `md` · `lg`.
on_pressEventHandler<()>—Pressed.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
EnterorSpaceAdvance to the next state

Accessibility

  • A real button; aria-busy while working; the label change is polite.
From the spec
  • Native button; aria-busy while working; polite label changes.

Motion & interaction

Timing
  • Reduced motion: no rise, blur or stagger; labels and values swap instantly (slot reels land at once, the shimmer band stops and the text stays muted).

Responsive behaviour

  • Width follows the label.
Edge cases (spec)
  • Width follows the label.

Notes for AI

  • Import StatefulActionButton from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • There is no GPUI version yet; use the Dioxus component.
  • Props to set first: model.
  • It reads a clock (now) for live timers; pass one clock for the whole page rather than one per component.
  • 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