ns-ui

Button Retry Backoff

A retry button that visibly winds a torsion spring through its backoff — disabled and charging while a --foreground arc grows on real timing, notching every failure, pressable only once fully wound.

Use when a retry the user presses where the wait must be honest, the button genuinely disabled while a torsion arc winds on the real computed backoff timing and notches on every failure; pick button-cooldown-heat instead when the limit is driven by the user's own click rate rather than by a server's backoff schedule, or autosave-ratchet when the save retries itself and there is no button to press.

Install

npx shadcn add https://design.helpmarq.com/r/button-retry-backoff.json
  • button
  • retry
  • error-handling
  • rate-limit
  • backoff
  • network

ns-ui / button-retry-backoff — rate-limited retry

Ready

Props

PropTypeDefaultDescription
onRetry?() => Promise<boolean> | booleancalled when the user presses Retry once idle/charged; resolve/return false (or throw) to report failure, anything else counts as success
baseDelayMs?numberwind duration for the first failure, ms (default 4000 — a real cooldown)
factor?numbermultiplier applied per additional consecutive failure (default 2)
maxDelayMs?numberupper bound on wind duration regardless of attempt count (default 60000)
maxNotches?numberfixed angular slots the ring can notch before saturating (default 8) — the attempt count in the text description is never capped, only the ring
label?stringbutton label in the idle/charged state (default "Retry")
className?string