274
An offline banner for apps: it counts the changes kept on the device, rolls a retry countdown with backoff, shows liquid dots while reconnecting, then turns into Back online with a drawn check and slides away.
akaoffline·connection lost·network
Run this in any project set up for the shadcn CLI. It copies the Connection Lost source into your components folder, so the code is yours to change.
npx shadcn@latest add https://devl.dev/r/connection-lost.jsonImport it and render it. Every prop has a typed default, so it works straight away, and you pass your own data when you’re ready.
import { ConnectionLost } from "@/components/connection-lost";
export default function Page() {
return <ConnectionLost />;
}A free React component in the Empty & Error collection, written in TypeScript with Tailwind CSS on coss ui. MIT licensed.
Read from the Connection Lost source. Everything is optional unless it says required.
| Prop | Type | Default |
|---|---|---|
| onlinerequired | boolean | — |
| pendingChanges | number | 0 |
| retryDelays | number[] | [8, 15, 30] |
| checkConnection | () => Promise<boolean> | — |
| settleAfter | number | 2600 |
| onSynced | (count: number) => void | — |
| onPhaseChange | (phase: ConnectionPhase) => void | — |
| className | string | — |