# Status bars

> A status page that reads at a glance: ninety days a service drawn up bar by bar, one card that glides between them, and incidents whose updates open in as they're posted.

Status pages usually give every one of ninety bars its own tooltip, and announce an incident by swapping the whole page. Here one line says how things are and morphs when a service changes ("All systems operational" → "Some systems degraded"), its dot changing colour with it. Each service draws its days up from the baseline, left to right, with its uptime rolling beside it; a narrow card shows the last thirty. Point at a day, or arrow along with the keys, and one card glides from bar to bar saying what happened that day. An open incident shows its updates newest first: a new update opens in on top and the stage pill morphs from Investigating through Identified and Monitoring to Resolved, and then it folds into Past incidents. Everything is props, so it reads from your own checks or a status service.

## Install

```bash
npx shadcn@latest add @hairline/status-bars
```

Needs React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.

- npm: none
- Hairline UI components it needs (the CLI installs them too): `text-morph`, `number-roll`
- Docs and live preview: https://hairlineui.com/ui/status-bars
- Registry item (source): https://hairlineui.com/r/status-bars.json

## Usage

```tsx
import { StatusBars } from "@/components/status-bars";

<StatusBars
  services={[{ id: "api", name: "API", status: "operational", uptime: 99.98, days }]}
  incidents={incidents}
  updatedAt={checkedAt}
/>
```

## From your own uptime checks

A cron checks each service every minute and writes one row per check. The page groups the last ninety days per service into a day status and the minutes it was down, and passes open and recent incidents as they are. The same shape maps from Better Stack, Instatus or Atlassian Statuspage.

```tsx
// app/status/page.tsx (a server component, revalidated every minute)
import { StatusBars, type StatusDay, type StatusService } from "@/components/status-bars";
import { db } from "@/lib/db";

export const revalidate = 60;

export default async function StatusPage() {
  const since = new Date(Date.now() - 89 * 86_400_000);
  const services = await db.service.findMany({ include: { days: { where: { date: { gte: since } }, orderBy: { date: "asc" } } } });
  const incidents = await db.incident.findMany({
    where: { OR: [{ resolvedAt: null }, { resolvedAt: { gte: new Date(Date.now() - 14 * 86_400_000) } }] },
    include: { updates: { orderBy: { at: "desc" } } },
    orderBy: { startedAt: "desc" },
  });

  const shaped: StatusService[] = services.map((s) => {
    const days: StatusDay[] = s.days.map((d) => ({
      date: d.date.toISOString().slice(0, 10),
      status: d.downMinutes > 30 ? "major" : d.downMinutes > 0 ? "degraded" : "operational",
      minutes: d.downMinutes || undefined,
      incidents: d.incidentTitles,
    }));
    const down = s.days.reduce((n, d) => n + d.downMinutes, 0);
    return { id: s.id, name: s.name, status: s.currentStatus, uptime: 100 - (down / (90 * 1440)) * 100, days };
  });

  return (
    <StatusBars
      title="Relay status"
      services={shaped}
      incidents={incidents.map((i) => ({ id: i.id, title: i.title, impact: i.impact, stage: i.stage, services: i.services, updates: i.updates }))}
      updatedAt={new Date()}
    />
  );
}
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `services` | `StatusService[]` | – | { id, name, status ("operational" \| "degraded" \| "major" \| "maintenance"), uptime?, days }. days are oldest first, the last one today: { date: "2026-10-14", status, minutes?, incidents? }. |
| `incidents` | `StatusIncident[]` | – | { id, title, impact ("minor" \| "major" \| "maintenance"), stage, services?, updates }. updates are newest first: { id, at, stage, message }. Resolved ones fold into Past incidents. |
| `updatedAt` | `Date \| string \| number` | – | When the data was checked; shown as "Updated 2 min ago" and kept current. |
| `title` | `string` | `"Status"` | Read before the overall line by screen readers. |

## States

- **overall**: Derived from the services: any outage reads "Major outage" (red), any degradation "Some systems degraded" (amber), maintenance "Maintenance in progress", otherwise "All systems operational" (emerald). The sentence lifts out and in through a blur; a dot pings while something is wrong.
- **days**: On mount every bar scales up from the baseline (520ms, 5ms apart, left to right). Operational days are emerald, degraded amber, outages red, maintenance grey and days without data a hairline outline. Containers under 32rem show the last 30 days.
- **read**: Hovering a bar dims the others to 55% and one card glides to sit over it (320ms), clamped inside the row: the date, what happened ("Degraded for 1 h 2 min") and the incidents that touched it.
- **keys**: Each service's bars are one tab stop. Focus starts on today; arrows move a day, Home and End jump to the ends, Escape hides the card. Each day is read out as you move.
- **incident**: Open incidents sit above the services with a coloured edge by impact. A new update fades down 6px out of a blur on top of the list; the stage pill morphs and turns green when resolved. Resolved incidents fold into "Past incidents", whose count rolls.
- **changes**: When a service's status changes its word morphs and its colour eases over 500ms; today's bar recolours in place.

## What it handles

Status pages usually give every one of ninety bars its own tooltip, and announce an incident by swapping the whole page. This reads at a glance and tells you what happened on each day.

- **One line says how things are**: It is worked out from the services: operational, some systems degraded, major outage or maintenance. Its dot changes colour with it.
- **Ninety days per service**: Each service draws its days up from the baseline with its uptime rolling beside it. Narrow cards show the last thirty.
- **One card for every bar**: A single card glides from bar to bar saying what happened that day, instead of ninety tooltips.
- **Incidents with updates**: Updates open in on top, newest first, and the stage pill morphs from Investigating to Resolved before folding into Past incidents.
- **Works from the keyboard**: Each service’s bars are one tab stop. Arrows move a day at a time, and each day is read out.
- **Your own data**: Everything is props, so it reads from your own checks or a status service. “Updated 2 min ago” stays current.

## Replaces

uptime bars, a status summary line, day tooltips, an incident timeline, a past incidents list

## Where it fits

- **Public status pages**: A page where customers check whether the service is up.
- **In-app system status**: A status screen inside a dashboard or admin area.
- **API and infrastructure providers**: Uptime per service, such as API, dashboard and webhooks.
- **Internal ops dashboards**: The state of internal services and recent incidents.

## Notes

- The overall line is a heading; each service names its bars, says its status in words and describes how to read them. The day card is drawn for the eye; keyboard reading announces each day in a status region instead.
- Colour is never the only signal: every service says Operational, Degraded, Outage or Maintenance, and every day says what happened in words.
- One card serves all the bars of a service, so ninety bars carry no tooltips or listeners of their own.
- The overall dot pings only while something is wrong.
- Reduced motion draws the bars at once, moves the card without gliding and swaps sentences in place.

License: MIT (https://hairlineui.com/license#components)
