Ir al contenido
Español

Cómo funciona

A flex row of equal blocks that share the available width, so 30 or 90 periods fit any card without scrolling; the gap scales with the width and stays between 1 and 3px. On mount the blocks grow up from the baseline in a quick left-to-right wave. Pointing at a block stretches it a little on a spring, dims every other block to 40% and opens a dark tip with the date, a colour swatch and status name, and an optional note. The tip aligns to the start, centre or end of the bar depending on where the block sits, so it never leaves the card.

Úsalo para

  • A status page or a health card: daily uptime of a few services.
  • Any streak of discrete outcomes: builds, check-ins, deliveries per day.

Busca otra opción cuando

  • Continuous values such as latency: use a line or bar chart.

Uso

import { TrackerBar } from './TrackerBar.jsx'

export function ApiUptime({ days }) {
  return (
    <TrackerBar
      title="Public API"
      value="99.95% uptime"
      label="Public API, daily status"
      data={days.map((d) => ({ key: d.date, status: d.status, label: d.dateLabel, note: d.incident }))}
      startLabel="90 days ago"
      endLabel="Today"
      legend
    />
  )
}

Propiedades

PropiedadTipoPor defectoQué hace
data{ key?, status: string, label: string, note?: string }[]—One entry per period, oldest first. status picks a colour and name from statuses; label (the date) and note appear in the tip.
statusesRecord<string, { label: string, color: string }>up / degraded / down / noneMerged over the defaults: success, warning, danger and the chart track colour.
title / valueReactNode—Name on the left and a figure such as uptime on the right, above the bar.
startLabel / endLabelReactNode—Ends of a thin axis under the bar.
legend / legendLabelboolean / stringfalseA legend of the statuses that occur in data.
roundedbooleantruePill-shaped blocks; false gives crisp 1.5px corners.
labelstring'Status history'Accessible name of the group of blocks.

Accesibilidad

  • The row is a group with a name; each block is an image named with its date, status and note, so the colour is never the only signal.
  • One block is in the Tab order (the latest); arrow keys move between blocks, Home and End jump to the ends, and Escape hides the tip.
  • The tip is decorative: what it shows is already each block's accessible name.
  • Reduced motion removes the wave and the stretch; dimming stays as an instant change.

Movimiento

Entrance: 520ms grow per block on the reveal curve, spread over 420ms across the row. Focus: 260ms spring stretch, 160ms dimming, 200ms tip rise.

Añádelo a tu proyecto

Copia la instrucción en Codex o Claude Code. El agente lee el código publicado, te muestra lo que va a escribir y añade el componente junto a los tuyos.

TrackerBar.jsxtracker-bar.csstokens.cssREADME.md

Los dos archivos se instalan juntos. La hoja de estilos lee las variables de tokens.css y lleva valores de reserva, así que también funciona sola.

Datos
Diferencias de código viene con Pro. La vista previa aparece al desbloquearlo.
Cuenta atrás con flip viene con Pro. La vista previa aparece al desbloquearlo.