Utility
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
| Prop | Type | Default |
|---|---|---|
error | Error | string | required |
onRetry | () => void | - |
onDismiss | () => void | - |
retryCount | number | 0 |
maxRetries | number | 3 |
isActive | boolean | true |
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/Spaceactivate the focused action when enabled;Escapedismisses or cancels when supported;Tab/Shift+Tabmove 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.