One row of day bars for one service. Up, degraded, down or no data, a tooltip on hover or focus, one tab stop with the arrow keys to inspect days, and a spoken summary worked out from the data.
On this page
Used for
- Model endpoint uptime
- Provider status
- Service health history
- Incident timelines
Examples
With incidents
Compact
Custom range
Installation
npx knowns-ui@latest add uptime-barFor Claude Code, Cursor or Codex: installs it and wires the props to your own data.
Paste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install prompt
Install Uptime bar from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/uptime-bar
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add uptime-bar
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- components/ui/knowns/uptime-bar/uptime-bar.tsx
- components/ui/knowns/uptime-bar/uptime-bar-utils.ts
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/uptime-bar, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "uptime-bar" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- daysrequired
UptimeDay[]- One entry per day, oldest first: { date, status: up | degraded | down | none, downtimeMinutes?, note? }. date is a YYYY-MM-DD string or a Date (read in UTC).
- label / sublabel
string- The service name and a muted line next to it. Without a label, pass aria-label.
- uptime
number|null- Default
computed - Overrides the percent worked out from days. null shows No data.
- showUptime
boolean- Default
true - The percent at the right of the label line.
- startLabel / endLabel
string- Default
n days ago / Today - The two ends under the bars. endLabel="" hides both.
- size
"sm"|"md"- Default
"md" - Bar height, 24 or 32 px.
- onDaySelect
(day, index) => void- Enter, Space or a click on a day.
- Uptime math
uptimePercent(days)- Days with no data are left out. downtimeMinutes count as downtime; a down day without minutes counts as a full day; a degraded day without minutes counts as none. 99.9999 is shown as 99.99%, never rounded up to 100%.
- Keyboard
listbox- The row is one tab stop. Left and Right move the inspected day, Home and End jump to the first and last, Enter selects. The tooltip follows.
- a11y
label- The row is named with a summary worked out from the data (uptime, incident count and the latest incidents with their minutes), and each day is announced as you move. Colour is never the only cue: the tooltip and the announcement say the status in words.
- Narrow
container query- The bars share the width, the gap and the corners tighten under 448 px. There is no horizontal scroll.
- Motion
tooltip- The tooltip and the dimming of other days fade in 120 ms. With reduced motion they change at once.
| Prop | Type | Default | Description |
|---|---|---|---|
| daysrequired | UptimeDay[] | required | One entry per day, oldest first: { date, status: up | degraded | down | none, downtimeMinutes?, note? }. date is a YYYY-MM-DD string or a Date (read in UTC). |
| label / sublabel | string | - | The service name and a muted line next to it. Without a label, pass aria-label. |
| uptime | number | null | computed | Overrides the percent worked out from days. null shows No data. |
| showUptime | boolean | true | The percent at the right of the label line. |
| startLabel / endLabel | string | n days ago / Today | The two ends under the bars. endLabel="" hides both. |
| size | "sm" | "md" | "md" | Bar height, 24 or 32 px. |
| onDaySelect | (day, index) => void | - | Enter, Space or a click on a day. |
| Uptime math | uptimePercent(days) | - | Days with no data are left out. downtimeMinutes count as downtime; a down day without minutes counts as a full day; a degraded day without minutes counts as none. 99.9999 is shown as 99.99%, never rounded up to 100%. |
| Keyboard | listbox | - | The row is one tab stop. Left and Right move the inspected day, Home and End jump to the first and last, Enter selects. The tooltip follows. |
| a11y | label | - | The row is named with a summary worked out from the data (uptime, incident count and the latest incidents with their minutes), and each day is announced as you move. Colour is never the only cue: the tooltip and the announcement say the status in words. |
| Narrow | container query | - | The bars share the width, the gap and the corners tighten under 448 px. There is no horizontal scroll. |
| Motion | tooltip | - | The tooltip and the dimming of other days fade in 120 ms. With reduced motion they change at once. |
What it handles
- 01Draws one bar per entry of `days`, oldest first, coloured up, degraded, down or no data, for any number of days.
- 02Works out the uptime percent from the days and shows it beside the `label` and `sublabel`, unless you pass `uptime` or turn `showUptime` off.
- 03Shows a tooltip for the hovered or focused day, placed at the start, centre or end of the row so it never leaves the edge.
- 04Keeps the whole row as one tab stop with a listbox role, moves a cursor between days with the arrow keys and calls `onDaySelect` on Enter, Space or click.
- 05Names the row for screen readers with a summary of the days, and gives each bar an accessible label describing its status.
- 06Offers `quiet` to dim the up days so only trouble stands out, a `size` of sm or md, and `startLabel` and `endLabel` for the two ends of the row.
States
- First render
- Nothing. It paints as it is
- none
- Hover or focus on a day
- The tooltip fades in over that bar
- 120ms, ease out
- Pointer or focus leaves
- The tooltip fades out where it was
- 120ms, ease out
- Cursor moves by keyboard
- The tooltip follows the selected day
- none
- Data change
- The bars are replaced at once
- none
| State | What moves | Timing |
|---|---|---|
| First render | Nothing. It paints as it is | none |
| Hover or focus on a day | The tooltip fades in over that bar | 120ms, ease out |
| Pointer or focus leaves | The tooltip fades out where it was | 120ms, ease out |
| Cursor moves by keyboard | The tooltip follows the selected day | none |
| Data change | The bars are replaced at once | none |
Works with
When to use
When to use
- Showing, day by day, whether one service was up, degraded or down over the last weeks or months.
- A status page row where people want to inspect a bad day with the keyboard or a hover.
When not to use
- A trend of a number over time: use Chart.
- Share of a limit used: use Progress.
- A single live state: use Status Dot.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Uptime Bar to my app and wire it to my own data.
- I need showing, day by day, whether one service was up, degraded or down over the last weeks or months. Set that up with the Knowns UI Uptime Bar.
- Which Uptime Bar props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "uptime-bar" }) and search_docs({ query: "uptime bar" }).