1.1k
Sponsor

Error Retry

Inline error callout with retry and dismiss shortcuts

Terminal

Installation

$ pnpm dlx shadcn@latest add @termcn/ink/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

Notes

Accessibility

termcn exposes the following behavior through Ink's terminal accessibility APIs. This is not a browser ARIA or general WCAG-conformance claim.

  • Keyboard: Enter / Space activate the focused action when enabled; Escape dismisses or cancels when supported; Tab / Shift+Tab move through Ink focus targets.
  • Focus and composition: Input is active only while the component's focus target is focused, enabled, active, and inside the topmost focus scope.
  • Screen reader: Screen-reader mode removes decorative output while preserving meaningful labels and state.