Components
Status light
A three-lamp signal for a service or a build: red, amber, green. One lamp lights at a time; the others stay dark. Running breathes the amber lamp and idle lights none. Lamps come on quickly and fade out slowly, as a bulb does.
pnpm dlx shadcn@latest add @caliper/status-lightWhen to use
Use it for
- Service health, build and deploy status, queue state.
- Rows where a coloured dot is too faint to read at a glance.
Skip it when
- More than five states; use a `Badge` per state instead.
- Colour as the only signal; the word beside the lamps is part of the design.
Decisions
Why it is built this way, so you know what to keep when you change your copy.
Behaviour
- On fast, off slow
- A lamp reaches full brightness in 150 ms and fades over half a second, so a change reads as a switch and not a blink.
Usage
- Always has words
- The state is written beside the lamps, with a plain default for each, and the lamps are hidden from assistive technology.
Installation
pnpm dlx shadcn@latest add @caliper/status-light
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage
This is the code behind the preview above.
import { useState, type ReactNode } from "react" import { Button } from "@/components/ui/button" import { StatusLight, type LightState } from "@/components/ui/status-light" function Panel({ title, context, className = "max-w-md", children }: { title: string; context: string; className?: string; children: ReactNode }) { return ( <section className={`grid w-full gap-5 rounded-overlay border border-border bg-background p-6 shadow-resting max-sm:p-4 ${className}`}> <div className="grid gap-1"> <p className="font-medium">{title}</p> <p className="text-sm text-muted-foreground">{context}</p> </div> {children} </section> ); } const services: { name: string; state: LightState }[] = [ { name: "API", state: "ok" }, { name: "Search", state: "warn" }, { name: "Payments", state: "fail" }, { name: "Deploy", state: "running" }, { name: "Backups", state: "idle" }, ]; const cycle: LightState[] = ["ok", "warn", "fail", "running", "idle"]; export function StatusLightDemo() { const [index, setIndex] = useState(0); return ( <Panel title="Services" context="One lamp at a time, always with a word."> <div className="grid gap-3"> {services.map((service) => ( <div key={service.name} className="flex items-center justify-between gap-3 text-sm"> <span className="text-muted-foreground">{service.name}</span> <StatusLight state={service.state} orientation="horizontal" /> </div> ))} </div> <div className="flex items-center justify-between gap-3 border-t border-border pt-4"> <StatusLight state={cycle[index]} /> <Button variant="secondary" size="sm" onClick={() => setIndex((value) => (value + 1) % cycle.length)}> Next state </Button> </div> </Panel> ); }
API reference
StatusLight
component
Also accepts the native props of its root element and a ref.
Accessibility
It exposes status semantics, with aria-label and aria-hidden kept in step with state. Changes that matter are announced through a live region.
No custom key handling; Tab and the native activation keys do the work.
Motion
It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.
Related
- Status iconThe small status glyph beside a task: a dashed ring for backlog, an open ring for todo, a ring filling like a pie while in progress and in review, a filled disc with a tick when done and a crossed disc when cancelled. Every state is built from the same four shapes, so a change animates from one to the next.
- Live indicatorWhether a feed is live, in words and a dot. The dot sends out a soft ring only while live, blinks while reconnecting and rests otherwise, and gives one extra ring for each update you tell it about.
- Status centerA full status page: one line that says whether everything works, incidents with every update, planned maintenance, each component's 90 days read day by day, past incidents with how long they lasted, and email updates.