Fallback Chain
A request passed from model to model like a relay, with why each one failed and a receipt for the detour.
PROGet Fallback Chain and 168 other Pro components with pro lifetime — Get Pro
- Category
- AI Agent
- Access
- ProPro · unlocked
- Source
- 334 lines · one file
- States
- 6 drawn
- Added
- 3 Nov 2026
The decision inside it
Every failure says why, and the cost is counted
A fallback that quietly answers from a cheaper model looks like success until the quality drops. Each skipped model keeps its reason, and the strip shows the seconds added and how the final price compares with the first choice.
When to use it
Use Fallback Chain when requests can fall back across models or providers and people need to see which one answered and why the others didn't. To choose a model use Model Picker; for a failed generation use Generation Error.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Fallback Chain for this.
Install it: npx shadcn@latest add @liro/fallback-chain
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/fallback-chain.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
import { FallbackChain, type FallbackAttempt } from "@/components/ui/fallback-chain";
export function ModelFallback({ attempts, tokens, retry }: {
attempts: FallbackAttempt[];
tokens: number;
retry: () => Promise<void>;
}) {
return <FallbackChain request="Summarise the Q3 board pack" attempts={attempts} tokens={tokens} onRetry={retry} />;
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
request | string | Yes | – |
attempts | FallbackAttempt[] | Yes | – |
tokens | number | No | Tokens in the call, for the cost difference. |
onRetry | () => void | Promise<void> | No | Tries the first choice again. May return a promise. |
title | string | No | – |
look | Look | No | – |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLiro foundations, installed alongside it
liro-themebuttonStates
All of them are drawn by the component. None is left for you to design.
- Trying
- Fell back
- Answered first time
- Costly fallback
- All failed
- Retry
Accessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances