Status Dot
A small colored dot for inline status indication. Six semantic statuses, three sizes, an optional pulse halo for "live" states, and an optional inline label that picks up the status color.
IdleOnlineHealthyDegradedDownStreaming
Customize
Status
active
md
Label & pulse
Online
Installation
npx shadcn@latest add https://craftbits.dev/r/status-dot.jsonUsage
import { StatusDot } from "@craft-bits/core";
<StatusDot status="active">Online</StatusDot>When status="active", the pulse halo is on by default — pass pulse={false} to force it off, or pulse on any other status to opt in:
<StatusDot status="success" pulse>Streaming</StatusDot>
<StatusDot status="active" pulse={false}>Online (quiet)</StatusDot>The label is optional — drop the children and you get just the dot:
<StatusDot status="error" size="lg" aria-label="Service down" />Understanding the component
- Status-driven palette.
statusselects six semantic colors (idle,active,success,warning,error,accent). The dot fills the color; if a label is present, it inherits the same color via a sibling<span>so the eye reads dot and word as one signal. - Sizes.
size="sm"(6px),"md"(8px, default), and"lg"(10px) — picksmfor inline-with-text use,lgfor stand-alone status chips. - Pulse via CSS, not JS. The
@keyframes cb-status-dot-pulserule is injected once into<head>the first time a pulsing dot mounts. It's wrapped in@media (prefers-reduced-motion: no-preference)so reduced-motion users see a static dot automatically — no JS branch. - Smart pulse default. When
status="active", pulse is on by default — that's the only status whose semantic meaning is "actively happening." Every other status defaults to static. Passpulseexplicitly to override either way. - Inline-flex layout.
align-middlekeeps the dot optically centered against surrounding text; the label is a sibling<span>so it can be styled independently if needed.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
status | 'idle' | 'active' | 'success' | 'warning' | 'error' | 'accent' | 'idle' | Semantic status color. |
size | 'sm' | 'md' | 'lg' | 'md' | Dot diameter. |
pulse | boolean | true when status="active", else false | Adds a halo that respects prefers-reduced-motion. |
children | ReactNode | — | Optional inline label rendered after the dot. |
className | string | — | Merged onto the rendered <span>. |
Accessibility
- The component renders a single
<span>whose label (if provided) is announced as-is by screen readers. The dot itself is markedaria-hidden="true"so assistive tech reads only the label. - For dynamic status updates, wrap the StatusDot in an element with
role="status"oraria-live="polite"so screen readers announce changes. - When used without a label, supply
aria-labelso the dot has an accessible name — otherwise it's invisible to assistive tech. - The pulse animation is automatically disabled when
prefers-reduced-motion: reduceis set — the rule is scoped under@media (prefers-reduced-motion: no-preference). Reduced-motion users see a static dot.
Credits
- Extracted from:
craftingattention(app/src/components/ui/StatusDot.tsx). The status name set (idle | active | success | warning | error | accent) blends CA's runtime tones with terminal-dreams' literal-union shape.