Staaarter

Rate Limit Cooldown

A full-height 429 screen: a square eyebrow and status code over a hairline rule, an accent headline, three bordered usage cells (requests used, limit, resets in), and a real live countdown that ticks down every second and swaps itself for a retry button once it reaches zero.

By Staaarter Team
Error
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its button dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/rate-limit-cooldown.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/error/error25.tsx instead.

Usage

The file also exports error25Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Error25, error25Demo } from "@/components/blocks/error/error25";

export default function Page() {
  return <Error25 {...error25Demo} />;
}

Props

PropTypeDefaultDescription
eyebrowstringnoneSmall square-marker label above the status code, e.g. "Rate limited".
statusCodestringnoneStatus line shown under the eyebrow, e.g. "429 Too Many Requests".
headingReactNodenoneMain headline, can include an inline accent span.
descriptionstringnoneSupporting copy under the headline.
cellsUsageCell[]noneThree bordered usage stat cells, e.g. Requests used / Limit / Resets in.
cooldownSecondsnumbernoneSeconds the live cooldown counter starts from.
retryLabelstringnoneLabel for the retry button shown once the cooldown reaches zero.
classNamestringnoneExtra classes for the outer section element.

Types

interface UsageCell {
  label: string;
  value: string;
}

Behavior notes

  • The cooldown is a real setTimeout-driven countdown started from cooldownSeconds and re-armed each second in a useEffect keyed on secondsLeft, cleared on unmount.
  • Once secondsLeft reaches 0, the countdown text is replaced with a real, enabled retry Button; clicking it does not actually retry a request against a backend.
  • The three usage cells are static demo data with no live connection to real request counts.