LogStream
A live log tail. Tabs filter by level, and one button pauses and resumes the stream.
Logs
worker · staging- infobuild finished·duration=3.2s·bundle=184kb
- warnretry scheduled·attempt=2·delay=500ms
- infocleanup·removed 26 stale sessions
- errorrender failed·component=PricingTable·timeout=5923ms
- infojob queued·job=2815·queue=default
- infocache hit·entry=preview-590·age=42ms
- warnrate limit warning·rpm=81/100·route=/api/render
- infosocket connected·client=canvas-02·ping=12ms
- infowebhook delivered·status=200·duration=142ms
- errorinvariant failed·props.items=must be an array
- warnslow query·duration=812ms·table=components
- infoagent run finished·steps=6·duration=1.8s
- infobuild finished·duration=3.2s·bundle=184kb
- warnretry scheduled·attempt=2·delay=500ms
Installation
Run this in a project that has a components.json. It adds one file, components/tenor-ui/log-stream.tsx, and no packages.
pnpm dlx shadcn@latest add https://tenor.design/r/log-stream.jsonNo components.json? Fetch the file. It works in any React project.
curl --create-dirs -o src/components/tenor-ui/log-stream.tsx https://tenor.design/r/log-stream.tsxUsage
Every prop is optional. With none, it renders the content you see above.
<LogStream />import { LogStream, type LogStreamLine } from "@/components/tenor-ui/log-stream";
const lines: LogStreamLine[] = [
{ level: "info", message: "deploy started", details: [{ label: "sha", value: "9f2c1ab", kind: "word" }] },
{ level: "info", message: "migrations applied", details: [{ label: "count", value: "3", kind: "number" }, { label: "duration", value: "1.4s", kind: "number" }] },
{ level: "warning", message: "slow query", details: [{ label: "duration", value: "812ms", kind: "number" }, { label: "table", value: "invoices", kind: "word" }] },
{ level: "error", message: "request failed", details: [{ label: "status", value: "502", kind: "number" }, { label: "route", value: "/api/checkout", kind: "path" }] },
{ level: "info", message: "deploy finished", details: [{ label: "duration", value: "41s", kind: "number" }] },
];
export function ApiLogs() {
return <LogStream lines={lines} source="api · production" command="tail -f /var/log/api.log" startTime="09:14:02" />;
}Props
| Prop | Type | Default | What it does |
|---|---|---|---|
lines | readonly LogStreamLine[] | logStreamLines | Lines to stream, in order. The set repeats from the top. |
title | string | "Logs" | Heading. |
source | string | "worker · staging" | Where the log comes from, shown beside the heading. |
command | string | "tail -f /var/log/worker.log" | Command shown at the bottom right. |
startTime | string | "18:22:24" | Time on the first row, as HH:MM:SS. Each later line is one second on. |
interval | number | 700 | Milliseconds between lines. 0 holds the stream still. |
paused | boolean | None | Sets whether the stream is paused from outside. Left out, the button changes it. |
onPausedChange | (paused: boolean) => void | None | Called with the new state when the button is pressed. |
labels | Partial<LogStreamLabels> | logStreamLabels | Replaces the wording, key by key. |
theme | "dark" | "light" | "dark" | Colour palette. |
It also takes every attribute of its root element, such as className and style.
Theming
Set any of these CSS variables on the component or on an ancestor. Each falls back to the look shown here.
--tui-surface--tui-stroke--tui-text--tui-muted--tui-console--tui-control--tui-control-hover--tui-content--tui-dim--tui-count--tui-separator--tui-newest--tui-info--tui-warn--tui-error--tui-word--tui-number--tui-path--tui-font-sans--tui-font-mono