Skip to content
caliper ui docs

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.

Free
pnpm dlx shadcn@latest add @caliper/status-light

Services

One lamp at a time, always with a word.

API
Healthy
Search
Degraded
Payments
Down
Deploy
Running
Backups
Idle
Healthy
Installs components/ui/status-light.tsxDepends on none beyond ReactMotion none in component source

When 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

terminal
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.

example.tsx
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.

PropTypeDefaultDescription
state *LightState—
labelstring—The word beside the lamps. Defaults to a plain name for the state; pass "" to show lamps only.
orientation"horizontal" | "vertical""vertical"

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.

All Changing values examples