Retry After

Retry After is a copy-paste React component that stops retry spam extends the lockout before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/retry-after
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsRetry spam extends the lockout

Was this component page useful?

How do I install Retry After?

pnpm dlx shadcn@latest add @bollard/retry-after

The files land in your project. They're yours to edit.

How do I use Retry After in React?

retry-after-usage.tsx
import { RetryAfter, type RateLimitResponse } from "@/components/ui/retry-after"

<RetryAfter defaultResponse={limited(12)} onAction={send} disabled={!message.trim()}>
  Send message
</RetryAfter>

What input mistakes does Retry After catch?

  • Retry-After as delay-seconds or an HTTP-date
  • IETF RateLimit / RateLimit-Policy fields and common X-RateLimit headers
  • Repeated clicks during the wait, swallowed with a gentle note
  • Automatic retry with jitter, capped by maxAutoRetries
  • Fallback backoff when the server gives no hint

What props does Retry After accept?

RetryAfter props
PropTypeDefault
onAction* (required)

Sends the request. Resolve with the Response (or `{ status, headers }`); a 429/503 starts the wait.

() => unknown—
children* (required)

Button label, e.g. "Send message".

React.ReactNode—
defaultResponse

Start already limited, e.g. when the page loaded after a 429.

RateLimitResponse—
autoRetry

Retry by itself when the wait ends (with jitter, never early).

booleantrue
maxAutoRetries

Automatic retries before handing control back to the user.

number3
noun

What is being limited, used when the server doesn't name its policy ("messages").

string"requests"
onRateLimit

Called on every 429/503 with what was parsed.

(info: RateLimitInfo) => void—
waitingLabel

Templates. `{time}` is the countdown, `{at}` when it will send, `{reset}` when the server's limit resets, `{limit}`, `{noun}`, `{per}` describe the limit.

string"Retry in {time}"
pendingLabel

Button label while the request runs.

string"Sending…"
tooManyText

Explains a 429 (too many requests).

string"Too many attempts. You can try again in {time}."
busyText

Explains a 503 (service busy).

string"The service is busy right now. Try again in {time}."
limitText

Names the limit that was hit, when headers say.

string"The limit is {limit} {noun} per {per}. It resets at {res…
keptText

Reassures that the user's input was kept.

string"Nothing you typed is lost."
autoText

Says an automatic retry is scheduled.

string"We’ll send it automatically."
readyText

Announced when the wait is over.

string"You can send again now."
exhaustedText

Shown when automatic retries are used up.

string"Still limited after several tries. Wait a little, then s…
spamText

Shown when the user keeps clicking during the wait.

string"No need to click: extra tries can make the wait longer."
sendingAtText

Says when the retry will be sent.

string"Sending at {at}."
cancelAutoLabel

Label of the button that cancels the automatic retry.

string"Don’t send automatically"
errorText

Shown when the request fails for another reason.

string"That didn’t go through. Try again."
className

Class for the wrapper holding the button and its explanation.

string—

* required. Also accepts the native props of <button> (className, aria-*, data-*…), passed through to it.

How is Retry After accessible?

  • While waiting the button stays focusable with aria-disabled (not disabled) and is described by the reason
  • aria-busy while the request is pending
  • Wait reason in a polite live region; the spam note is assertive; errors use role=alert
  • Label transition animation is skipped under reduced motion

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Enforce the rate limit server-side and send Retry-After; the client wait only reduces wasted requests.

  • Client-side wait only; another tab or a direct request is not held back
  • RateLimit fields follow an IETF draft and vendor variants; unusual headers fall back to backoff
  • The countdown uses performance.now(), so it survives clock changes but not a page reload

What validation rules apply to Retry After?

Rules last verified:

Retry-After (HTTP-date or delay-seconds) confirmed in RFC 9110. RateLimit/RateLimit-Policy parsing follows an IETF draft and was not re-verified this round. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What expensive mistakes does Retry After stop?

Retry spam extends the lockout

Also known as

429 · rate limit · retry-after · too many requests · throttling · resend otp · backoff · 503

What dependencies does Retry After require?

Retry After facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameRetry After
Registry identifier@bollard/retry-after
Install commandnpx shadcn@latest add @bollard/retry-after
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Retry After

What form validation mistake does Retry After catch?

Retry After prevents retry spam extends the lockout. Turns a 429/503 into a clear wait: which limit was hit, when it resets, a countdown, and one automatic retry instead of impatient re-clicks. Catches: Retry-After as delay-seconds or an HTTP-date, IETF RateLimit / RateLimit-Policy fields and common X-RateLimit headers, Repeated clicks during the wait, swallowed with a gentle note, Automatic retry with jitter, capped by maxAutoRetries, Fallback backoff when the server gives no hint. Limitation: validate retry-after schemas on backend.

How do I install retry-after with shadcn?

Run `npx shadcn@latest add @bollard/retry-after`. Sources added: registry/default/retry-after/rate-limit.ts, registry/default/retry-after/retry-after.tsx. Package requirements: lucide-react.

What props customize Retry After?

Retry After accepts `onAction`, `children`, `defaultResponse`, `autoRetry`, `maxAutoRetries`. Configures 429, rate limit, retry-after behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of retry-after?

Client-side wait only; another tab or a direct request is not held back. RateLimit fields follow an IETF draft and vendor variants; unusual headers fall back to backoff. The countdown uses performance.now(), so it survives clock changes but not a page reload Server requirement: Enforce the rate limit server-side and send Retry-After; the client wait only reduces wasted requests.

How does Retry After meet accessibility guidelines?

While waiting the button stays focusable with aria-disabled (not disabled) and is described by the reason. aria-busy while the request is pending. Wait reason in a polite live region; the spam note is assertive; errors use role=alert. Label transition animation is skipped under reduced motion. Minimizes errors: too many requests error, 429 rate limit.

Which components pair with Retry After?