Feedback

ConnectionIndicator

Quiet inline dot-and-word status for a live connection, telling connecting, live, reconnecting, polling, stale, out-of-date, and closed apart by shape and text, not color alone.

import { ConnectionIndicator } from '@lostgradient/cinder';
connectionstatusrealtime
01

Overview

Reference usage

Quiet inline status for a live connection: a glyph and a word, with no pill around them. Renders one of seven states — connecting, live, reconnecting, polling, stale, out-of-date, closed — as a muted text label plus a glyph (an icon, a pulsing green dot for live, a still neutral dot for reconnecting, a hollow ring for out-of-date), so status is never conveyed by color alone.

live shows a small pulsing green dot, with no icon (a static dot under prefers-reduced-motion: reduce). out-of-date is the hollow neutral ring a status dot draws for a pending state, never green: it means retries have stopped and the data shown is the last that loaded. polling is deliberately quieter than live: no motion, a lighter label weight, and its own icon, so it can't be mistaken for push. reconnecting is a still neutral dot (the solid control-border dot a neutral status dot draws), never green and never pulsing, so it reads "Reconnecting" on its own while the banner carries the retries. It accepts an optional attempt snippet for a retry count like "attempt 3 of 5" where no banner shows one.

Use ConnectionIndicator for a compact, self-contained dot and word that reports transport health. Use StatusDot for annotating a static entity's state (a row, a user, a deployment) instead of a live transport. Use Feed's log arm for a full event log rather than a single status pill.

Usage

svelte
<script lang="ts">
  import { ConnectionIndicator } from '@lostgradient/cinder';
</script>

<ConnectionIndicator status="live" />
<ConnectionIndicator status="polling" />
<ConnectionIndicator status="closed" />

With an attempt count

svelte
<script lang="ts">
  import { ConnectionIndicator } from '@lostgradient/cinder';
</script>

<ConnectionIndicator status="reconnecting">
  {#snippet attempt()}
    attempt 3 of 5
  {/snippet}
</ConnectionIndicator>

Out of date

svelte
<ConnectionIndicator status="out-of-date" />

With a label override

svelte
<ConnectionIndicator status="stale" label="Data may be old" />
Live preview

Basic connection indicator

Live

02

When to use

Use when
  • Surfacing the transport-level health of a websocket, SSE stream, or polling loop as a compact, self-contained dot and word.
  • Distinguishing push (`live`) from interval polling (`polling`) so operators don't mistake one for the other.
Avoid when
  • Annotating a static entity's state (a row, a user, a deployment) rather than a live transport — use status-dot instead. Use Status Dot instead
  • Rendering a full event log with per-event connection transitions — use feed's log arm instead. Use Feed instead
03

Examples

Basic connection indicator

A live connection pill with its default icon and label.

Polling vs live

Polling reads quieter and different from live through icon, motion, and font-weight — not color alone.

Reconnecting with attempt count

The reconnecting state showing a retry attempt via the attempt snippet.

All connection states

Each of the seven states with its own word and glyph: a dot for live, a hollow ring for out of date, an icon for the rest. The word is always muted and the glyph carries the tone, so the glyph shape and the word carry the distinction, never color alone.

04

Props

Props for connection-indicator
Name
Type
Default
Description
status required 'connecting''live''reconnecting''polling''stale''out-of-date''closed' Current connection lifecycle state. Drives the glyph, text, and tone via data-cinder-status.
label text Optional human label override. Replaces the default text for status (and the "Connection: …" accessible name).
attempt snippet Attempt-count content rendered next to the label when status is 'reconnecting', e.g. "attempt 3 of 5". Ignored for other states.
05

Accessibility

Status is conveyed by shape and text together, never color alone (WCAG 1.4.1): live is a dot, out-of-date a hollow ring, the rest an icon. The live pulsing dot collapses to a static dot under prefers-reduced-motion.