# ConnectionStatus

Whether you’re connected, with the reconnect and catch-up actions your app supports.

- **Use it for**: The connection state with reconnect and replay actions.
- **Not for**: A run state. Try [StatusBadge](https://unseenui.com/components/status-badge/), [BackgroundStatus](https://unseenui.com/components/background-status/).

## Installation

```bash
npm install @stackunseen/ui
```

## Usage

```tsx
import { ConnectionStatus } from '@stackunseen/ui';
import '@stackunseen/ui/styles.css';

<ConnectionStatus variant="banner" value={connection} onResume={resume} onRefresh={refreshSnapshot} />
```

## Props

- `value` (`ConnectionInfo`): Whether you’re connected, how fresh the data is, which recovery actions your connection supports, and where to resume from.
- `submission` (`SubmissionState (optional)`): The recovery request state. Defaults to idle; track unknown outcomes explicitly.
- `onResume` (`(cursor: RecoveryCursor) => void (optional)`): Ask your server to pick up where it left off, when your connection supports it.
- `onRefresh` (`() => void (optional)`): Ask for fresh data, when your connection supports it.
- `error` (`string (optional)`): The recovery failure to show alongside the retained connection state.
- `variant` (`'banner' | 'card' | 'compact' (optional)`): Choose a presentation for the available space. Defaults to banner.

## All props

| Prop | Type | Description |
| --- | --- | --- |
| `className` | `string` | Added to the root element, after the component's own classes. |
| `error` | `string` |  |
| `onRefresh` | `(() => void)` |  |
| `onResume` | `((cursor: RecoveryCursor) => void)` |  |
| `submission` | `SubmissionState` |  |
| `value` (required) | `ConnectionInfo` |  |
| `variant` | `"compact" \| "card" \| "banner"` |  |

## Keyboard

Tab reaches available recovery actions and connection details. Enter or Space activates an action or opens the details.

## Works with

[WorkSummary](https://unseenui.com/components/work-summary/), [ChainOfThought](https://unseenui.com/components/chain-of-thought/), [Plan](https://unseenui.com/components/plan/), [WorkflowGraph](https://unseenui.com/components/workflow-graph/), [RunInspector](https://unseenui.com/components/run-inspector/), [AgentSteps](https://unseenui.com/components/agent-steps/), [ExecutionTimeline](https://unseenui.com/components/execution-timeline/), [RunBoard](https://unseenui.com/components/run-board/), [AgentLanes](https://unseenui.com/components/agent-lanes/), [AttentionQueue](https://unseenui.com/components/attention-queue/), [RunSummaryCard](https://unseenui.com/components/run-summary-card/), [BackgroundStatus](https://unseenui.com/components/background-status/)

Page: https://unseenui.com/components/connection-status/
