Uptime Card

An interactive status card with magnifying uptime bars, incident logs, and multi-service monitoring.

Uptime Card

An interactive status card with magnifying uptime bars, incident logs, and multi-service monitoring.

Each service gets one row of daily bars, colored green for operational, amber for degraded, rose for an outage, and zinc for days with no data. Hovering or focusing a day swells that bar and its neighbors so a single day is easy to hit in a 90-day strip; clicking pins it and opens the incident log with a full timeline of updates.

Installation

Install the component with the Craft-UI Blocks CLI — it drops uptime-card.tsx into your project and wires up its runtime dependencies:

npx mvpblocks add uptime-card
pnpm dlx mvpblocks add uptime-card
yarn dlx mvpblocks add uptime-card
bunx mvpblocks add uptime-card

File Structure

The CLI saves the component to your project's components/ui folder:

Import the default export from @/components/ui/uptime-card. The prop types are exported as UptimeCardProps, UptimeService, Incident, IncidentUpdate, and DayStatus.

Usage

UptimeCard is a client component and every prop is optional — with no props it renders four demo services across 90 days. Drop it into a wide card slot:

"use client";

import UptimeCard from "@/components/ui/uptime-card";

export function StatusCard() {
  return <UptimeCard />;
}

Incidents are keyed by day index, where 0 is the oldest day shown and days - 1 is today. status is "degraded" or "down", minutes is the impact length, and updates is a timeline. missing marks the first days before a service existed:

const services = [
  {
    name: "API",
    incidents: {
      15: {
        title: "Slow response times",
        status: "degraded",
        minutes: 25,
        updates: [
          { time: "10:15", label: "Investigating" },
          {
            time: "10:30",
            label: "Identified",
            note: "Slow database queries in one region.",
          },
          { time: "10:40", label: "Resolved" },
        ],
      },
    },
  },
  {
    name: "Database",
    missing: 10,
    incidents: {},
  },
];

<UptimeCard
  title="Infrastructure status"
  services={services}
  days={90}
  endDate="2026-10-14"
/>

endDate is read in UTC as YYYY-MM-DD and labels the last bar. Use className to fit the card into a different layout:

<UptimeCard className="max-w-2xl" />

Theming

The surface is rounded-3xl border-zinc-200 bg-white in light mode, inverting to dark:border-zinc-800 dark:bg-zinc-950. Text is zinc-based, uptime percentages and dates are tabular-nums, and the incident panel is bg-zinc-50 (dark:bg-zinc-900).

Bar colors come from the status: bg-emerald-500 dark:bg-emerald-400 for up, bg-amber-400 dark:bg-amber-300 for degraded, bg-rose-500 dark:bg-rose-400 for down, and bg-zinc-200 dark:bg-zinc-800 for no data. The header shows a green check when every service is up or an amber warning with the affected count. Incident badges are rose for outages and amber for degradation, and className can override the outer card freely.

Animations

  • Swell: the focused bar grows 5× wider with a Gaussian falloff spreading about 2.4 bars to each side.
  • Ease: bar widths move toward their targets at a rate of 18/s using 1 - exp(-18 × dt); the RAF loop stops when they settle.
  • Focus tracking: the day under the pointer is solved in three passes against the swollen layout so the enlarged bar stays under the cursor.
  • Fade: unfocused bars drop to 60% opacity over 150ms while a day is active.
  • Incident log: the pinned panel expands with a 260ms grid-rows transition and cubic-bezier(0.23, 1, 0.32, 1).
  • Reduced motion: bar widths jump straight to their targets and no animation loop is started.

How it works

statusOf returns "none" for days before a service's missing count, then looks up that day's incident, defaulting to "up". uptimeOf subtracts full minutes for outages and half minutes for degradation from the tracked minutes, then formats the result as a percentage.

Bars are flex children whose flex-grow is written directly by the paint loop. Focus replaces the target weights with a Gaussian swell, barAt maps a pointer x-position to a day using those weights, and the loop repeats three times so the magnified bar centers under the pointer rather than drifting away.

The strip is a focusable role="slider" with an aria-live summary. Arrow keys move one day, Home and End jump to the ends, Enter or Space pins the day, and Escape clears it. Touch users can drag across the bars because pointer capture keeps focus on the strip. Pinning a day opens its incident log; the close button or another Enter dismisses it.

Props

Prop

Type

UptimeService

Prop

Type

Incident

Prop

Type

IncidentUpdate

Prop

Type

Registry Bundle

Install the exact registry entry shown on the right when you want the component file and its declared runtime dependencies together. Dependency: lucide-react (status and close icons).

Contact

If you find any bug or issue, feel free to raise an issue.

Last updated on