Skip to content
caliper ui pro docs

Cooldown button

A button that has to rest after it is used: resend a code, retry a payment, nudge a teammate. A ring drains beside the label while the clock rolls down, a soft flash says it is ready, and it stays focusable while it waits, so the keyboard never loses its place.

Pro
Code sent.

When to use

  • Sending codes and emails that the server rate-limits.
  • Retries that should not be hammered.

When not to use

  • Waits longer than a few minutes; say when it will be possible instead.
  • Disabling a form for validation; explain the problem instead.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/cooldown-button

Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

API reference

CooldownButton

4 props

Also accepts the native props of its root element and a ref.

PropTypeDefaultDescription
label *string—What pressing does: "Resend code".
secondsnumber30How long it rests after a press.
waitingLabel((left: number) => string)—The words while resting, given the seconds left. By default the label, then a clock whose digits roll.
startCoolingbooleanfalseStart resting, e.g. when the page opens straight after a code was sent.

Keyboard

  • No custom key handling; Tab and the native activation keys do the work.

Accessibility

It is built on native elements and keeps aria-disabled and aria-hidden in step with state.

Notes for AI

Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.

/docs/components/cooldown-button.md

The index of every part is at /llms.txt.

More in Actions