Error & RetryPRO
An inline error for failed generations with a countdown and a calm Retry.
Code
1 file · 196 lines of TypeScriptPRO
Error & Retry is part of Pro
Get its source, the one-paste agent prompt and all 113 components, for a one-time $99.
Motion notes
- It rises a few pixels out of a blur, with no shake. A failed generation is common and usually not the user's fault, so the error stays quiet.
- The countdown ring drains on one linear tween over the whole wait, while the label ticks per second. Linear because an eased drain makes the last seconds feel slower than the first.
- Retry spins at a constant speed for as long as the promise is pending, then springs forward to the next full turn. It settles instead of snapping back.
- Screen readers hear the error once, then only “You can retry now” and “Retrying”, never each tick. With reduced motion the icon dims instead of spinning.
Usage
Example
{error && (
<ErrorRetry
variant={error.status === 429 ? "rate-limit" : "error"}
retryIn={error.retryAfter}
onRetry={() => regenerate()}
/>
)}Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "error" | "rate-limit" | "error" | Picks the icon, tone and default copy. |
| title | string | — | Defaults to “Something went wrong” or “Rate limited”. |
| description | string | — | A short line under the title. |
| retryIn | number | — | Seconds before Retry unlocks. Changing it restarts the countdown. |
| onRetry | () => void | Promise<unknown> | — | Return a promise to keep the icon spinning until it settles. |
| retrying | boolean | — | Controlled retrying state. Overrides the promise tracking. |
| className | string | — | Classes for the card. |