413
Sponsor

Error Retry

Inline error callout with retry and dismiss shortcuts

Terminal

Installation

$ pnpm dlx shadcn@latest add @termcn/error-retry

Usage

import { ErrorRetry } from "@/components/ui/error-retry";
<ErrorRetry
  error={new Error("Network error")}
  retryCount={0}
  maxRetries={3}
  onRetry={() => refetch()}
  onDismiss={() => setError(null)}
  isActive
/>

Shortcuts

When retryCount < maxRetries and isActive is true:

  • Enter or r — calls onRetry
  • Esc — calls onDismiss

After retryCount >= maxRetries, only Esc dismisses; retry shortcuts are disabled.

API Reference

ErrorRetry

PropTypeDefault
errorError | stringrequired
onRetry() => void-
onDismiss() => void-
retryCountnumber0
maxRetriesnumber3
isActivebooleantrue