Skip to content
satin

Action button

Runs an action and shows how it went in place: a spinner, then a checkmark.

Installation

Terminal
npm i @uisatin/ui
Import
import { ActionButton } from '@uisatin/ui/action-button'

About 15.5 kB of JavaScript, minified and gzipped, with what it imports (React aside). The stylesheet is one file for every component.

First time with Satin? Set it up once, styles and fonts included, with the installation guide.

API Reference

The ActionButton component is a Button that runs onAction and shows its state in place: the label with an arrow, a spinner until the promise settles, then a checkmark. It takes every Button prop.

PropTypeDefault
onAction
(event) => Promise<unknown>
—
onClick
(event) => void
—
variant
"primary""secondary""tertiary""inverse""destructive"
"primary"
size
"xs""md""lg""xl"
"md"
minLoading
number
900
resetAfter
numbernull
1800
trailingIcon
ReactNodenull
arrow
state
"idle""loading""success"
—
onStateChange
(state) => void
—
onError
(error) => void
—

Accessibility

A Button. While the action runs it has aria-busy and aria-disabled, keeps focus and ignores clicks; on success a polite live region says "Done" (done in SatinLabels). The spinner and checkmark are hidden. A failed action goes back to idle silently, so announce the error yourself.

KeyAction
EnterorSpaceRuns onAction. Does nothing while busy or done.