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-statesThe 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
- 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.
oxyn add action-statesUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Follow
Folds into a round spinner while it works.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Copy
Copied holds 1.5 s, then returns.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Deploy
Pending labels and tones.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Fails
A failed action shows Try again for 1.8 s.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
StatefulActionButton
| Prop | Type | Default | Description |
|---|---|---|---|
modelrequired | StatefulAction | — | Model. |
size | String | "md" | `sm` · `md` · `lg`. |
on_press | EventHandler<()> | — | Pressed. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| EnterorSpace | Advance 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
StatefulActionButtonfromoxyn_dioxusand includeSTATUS_INDICATOR_CSSplus 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.