# Reconnect strip

The connection, said once: offline slides an amber strip down, reconnecting turns it blue, back online turns it green and away.

Also called: offline banner, connection banner, reconnecting banner.

Example: The connection, said once. Offline slides an amber strip down with the seconds to the next try; reconnecting turns it blue as the signal arcs light; back online turns it green and it slides away. Preview: https://chatcn.dev/preview/reconnect-strip-demo

Losing the connection slides a slim amber strip down from the top edge of the thread with the seconds to the next try and a way to try now. While it reconnects the strip turns blue and the signal arcs light one after another from the centre out. When it is back it turns green, says Back online with a check and slides away by itself. It never stacks.

## Installation

```bash
npx shadcn@latest add https://chatcn.dev/r/reconnect-strip.json
```

## Usage

```tsx
import { ReconnectStrip } from "@/components/ui/chatcn/reconnect-strip"

<ReconnectStrip status={connection} retryIn={secondsToRetry} onRetryNow={reconnect} onSettled={() => setConnection("online")} />
```

## Examples

### States

Example: Offline, reconnecting, back. The strip in each state, held still: amber offline with the countdown, blue reconnecting, green back online. Preview: https://chatcn.dev/preview/reconnect-strip-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `status` | `"online" | "offline" | "connecting" | "restored"` | Online renders nothing |
| `retryIn` | `number` | Seconds to the next try, while offline |
| `onRetryNow` | `() => void` | Shows Try now |
| `restoredMs` | `number` | How long Back online stays. Default 1800 |
| `onSettled` | `() => void` | After the restored strip has gone |

## Accessibility

- A polite `role="status"`: each change is read once.

## Motion

- Slides in 420 ms, out 320 ms; colours cross fade 300 ms. The arcs fade in sequence, 180 ms apart. Reduced motion: fades and still arcs.

Source: https://chatcn.dev/docs/components/reconnect-strip