Status button
Save, Saving, Saved: the spinner opens in, the check draws itself, errors shake, and the label morphs between them.
Used forSave buttonsCopy buttonsRetry and UndoSign-up and checkout
Install with the shadcn CLI
Registered the namespace? Then it’s shadcn add @hairline/status-button. Set it up
Templates
Need the whole page?
63 Next.js landing pages, each designed from scratch. Try any of them live; one is $39, all of them $159, and 8 are free.
Where it’s used
Save buttons
Forms and settings where saving takes a moment and may fail.
Copy buttons
Copy link or Copy code, with a check when it worked.
Retry and Undo
Small toolbar buttons that show their own progress.
Sign-up and checkout
Submit buttons that show waiting, success and failure without a layout jump.
What it handles for you
It is the most common button in any product and usually the least considered: it greys out, maybe shows a spinner, and snaps back. This one handles every state of an action in one motion, and many other components in the library are built on it.
Save, Saving, Saved
A spinner opens beside the label as it morphs to “Saving”, then the label becomes “Saved”, keeping the letters they share.
A check that draws itself
On success the spinner blurs out as a check draws in.
Errors shake and offer a retry
On failure the button gives a small shake, tints softly red and reads “Try again”.
No layout jumps
The width eases to each label, so nothing around the button moves.
Three looks, two sizes
Primary, outline or ghost, at 36px or at 28px for toolbars.
Accessible by default
While pending it ignores clicks without dimming or losing focus, and state changes are announced beside it.
Overview
The most common button in any product, and usually the least considered: it greys out, maybe shows a spinner, and snaps back. Here every change is one motion. A spinner slides open beside the label as it morphs to "Saving"; on success a check draws itself and the label becomes "Saved", keeping the letters they share; on failure the button gives a small shake and asks you to try again. Its width eases to each label, so nothing around it jumps.
States
- idle
- The label and, if you pass one, an icon.
- pending
- A spinner opens in from zero width; the label morphs ("Save changes" → "Saving"). Clicks are ignored and aria-busy is set.
- success
- The spinner blurs out as a check draws itself in 420ms; "Saved". onReset fires after resetAfter.
- error
- A 380ms shake, a soft red tint and an alert icon; "Try again".
Usage
Works with
Installs with it
Built on it
- Live QRA QR code that re-issues itself in place: only the tiles that change turn over, an expired code becomes its Refresh button, and a scan draws a check from its own tiles.
- Release trainYour environments down a rail, each with the version it runs: promote one and a copy rides down to the next station, waits while it deploys, then docks.
- Empty stateWhat a list says before there is anything in it: an isometric line drawing in your theme that draws itself, changes with the state and acts out the action.
- Code inputThe six boxes, done properly: digits rise in, a paste cascades, a wrong code shakes and clears, the right one becomes a pill with a check.
- Steps formA multi-step form in one card that changes shape: steps slide in from the way you’re going, checks shake and explain, and Create turns into what comes next.
- Avatar cropperThe profile photo field without a modal: the avatar itself grows into the crop, and shrinks back with the face you framed.
- ComboboxPick one or several from a list your server searches: results morph between queries instead of flashing, and picks fly into chips.
- JSON inspectorRead, search and quote a webhook payload or an API response, or see exactly what changed between two versions of a record.
- Data tableA table whose rows travel: sort and every row glides to its rank, live data re-ranks itself, and selection turns the toolbar into its actions.
- Doc commentsReview threads beside the text they quote: the one you choose lines up with its line, and the rest make way.
- API keysThe API keys screen, done properly: the secret rises in once, and Done folds it down into the "sk_live_••••4f2a" it leaves behind.
- Env editorA structured .env and secrets editor with multi-line .env bulk paste, automatic 8×8 Bayer secret veiling, copy-while-veiled, duplicate key checks and Prod/Prev/Dev scopes.
- IP allowlistA CIDR and firewall allowlist editor with IPv4/IPv6 validation, live subnet host counts, wildcard exposure guards, containment checks and bulk paste.
- Team membersSettings → Members, done properly: invited addresses fly out of the field onto their rows, role pills grow into the list of roles, and seats roll.
- Settings formA settings page that saves the way people expect: switches save themselves, text edits gather into one bar that rises with "2 unsaved changes".
- Auth cardSign-in that asks one thing at a time: the email field shrinks into a chip round the address, and your server decides whether a password, a code or a link comes next.
- Sudo gateWrap any dangerous button. A padlock on its corner shows how long you stay verified; when it’s locked, the button grows right where it stands into the “Confirm it’s you” card.
- WebhooksSettings → Webhooks, done properly: "Send test" runs a bead down the wire to the endpoint and back in the answer's colour, and every delivery opens into its request and response.
- Domain connectA custom domain from typed to live: copyable records that tick green as DNS finds them, checks that wait longer each time, and a rail that runs to Live.
- CSV importContacts → Import, done properly: your file's columns thread themselves to your fields, bad cells become fields you fix in place, and the rows go to your server in batches.
- Notification inboxThe bell, done properly: its own circle grows into the inbox, new notifications swing it and roll the count, and read ones fold out of Unread.
- IntegrationsSettings → Integrations, done properly: Connect waits on the provider's own window, then folds away as the account it connected opens in its place.
- Code blockCode in an answer: highlighted as it streams, copy and wrap, long files folded, and an optional Apply.
- Error and limit statesCalm, specific notices for failed answers, being offline, rate limits and chats that grow too long.
- WalletA balance you can send from: the balance panel turns into the transfer, the button goes Sending → Sent, and the money visibly leaves.
- Pricing plansPlans that turn into their own checkout: pick one and its card becomes the order, seats and totals rolling, then Continue opens your checkout.
- BookingBook a call on one card: the time you pick prints onto the host’s ticket, then the times turn into your details and the confirmation.
- CartA cart whose receipt does the maths in front of you: codes are stamped on, a rail of light fills toward free shipping and every total rolls.
- ReferralA referral pass that fills as friends join: their faces fly up into its notches, and the last one turns the track into Claim.
- FeedbackA score that changes the question: pick 0–10 or stars, the score rolls into the panel, and the follow-up and its tags fit what you picked.
- Buy boxA product buy box whose swatches repaint the product: pick a colour and size, and Add to bag throws the product into the bag.
- CheckoutA one-page checkout whose steps stack into a receipt: contact, address, delivery and your payment element, then Place order turns into the order number.
- Order statusAn order’s route with a parcel riding it: stops light as it passes, the arrival day rolls, and the carrier’s scans slide in.
- SubscriptionA billing page in one card: the plan with a ring through its billing period, usage, card and invoices, and a cancel that offers a pause first.
- File shareDrop files, watch them upload, and they fold into one share link with an expiry and an optional password.
- Cookie consentA cookie banner with a mascot: every cookie you allow flies to Crumb, who catches it, nibbles it and gets rounder and happier.
- Create passwordA password step with a chameleon: the stronger the password, the better Hide blends in, until only his eye is left.
- Verify codeA one-time code step with a carrier pigeon: Coo naps through the resend wait with the seconds in a thought bubble, and flies every new code to your mailbox.
- Delete workspaceA danger-zone delete with a ghost: as you type the name, Boo climbs out of the workspace’s tile, and holding Delete waves him off the stage.
- TermsA terms-of-service step with an owl who reads along: Skim sums up each section in one plain line, gets dizzy if you scroll too fast, and gives a thumbs up at the end.
- WaitlistA waitlist that is an actual line: you step in at the end with your number over your head, and every friend who joins lets you hop past the person ahead.
- StorageA storage meter with a raccoon and his suitcase: near the limit the case bulges and Pack sits on it to shut it; clean up and he hops down, upgrade and a roomy trunk arrives.
- UsernameA username picker with a penguin holding a sign: your name appears on it as you type; if it’s taken, its smug owner slides in hugging a sign with your name on it.
Related
- Status capsuleA pill for something that takes a moment: a ring turns while it runs, and when it’s done a ribbon of light scans the pill and the words change under it.
- Status barsA status page that reads at a glance: ninety days a service drawn up bar by bar, one card that glides between them, and incidents whose updates open in as they're posted.
With a request
Drive status from your request; the button handles every transition.
Props
- status= "idle"
- "idle" | "pending" | "success" | "error"
- What the button shows.
- labels= Save, Saving, Saved, Try again
- Partial<Record<status, string>>
- Wording per state.
- icon
- ReactNode
- An icon beside the idle label, e.g. a link icon for Copy link.
- variant= "primary"
- "primary" | "outline" | "ghost"
- Filled with your brand colour, a hairline outline, or quiet text for toolbars.
- size= "default"
- "default" | "sm"
- 36px, or 28px for headers and toolbars (Copy in a code block, Undo in a receipt).
- onReset / resetAfter= — / 1800
- () => void / number
- Called that long after success, to go back to idle.
Accessibility and motion
- State changes are announced from a status region beside the button, so the button’s name stays just its label.
- While pending it is aria-busy and ignores clicks, without dimming or losing focus.
- The check is a stroked path that draws itself; the shake uses the Web Animations API. No animation library.
- Installs Text morph alongside it. With reduced motion, states change in place.
Requirements
React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.
The CLI also installs Text morph.
Source
Registry item: /r/status-button.json


