Skip to content
Browse components

LogStream

A live log tail. Tabs filter by level, and one button pauses and resumes the stream.

Logs

worker · staging
  1. infobuild finished·duration=3.2s·bundle=184kb
  2. warnretry scheduled·attempt=2·delay=500ms
  3. infocleanup·removed 26 stale sessions
  4. errorrender failed·component=PricingTable·timeout=5923ms
  5. infojob queued·job=2815·queue=default
  6. infocache hit·entry=preview-590·age=42ms
  7. warnrate limit warning·rpm=81/100·route=/api/render
  8. infosocket connected·client=canvas-02·ping=12ms
  9. infowebhook delivered·status=200·duration=142ms
  10. errorinvariant failed·props.items=must be an array
  11. warnslow query·duration=812ms·table=components
  12. infoagent run finished·steps=6·duration=1.8s
  13. infobuild finished·duration=3.2s·bundle=184kb
  14. warnretry scheduled·attempt=2·delay=500ms
streaming · 14 linestail -f /var/log/worker.log

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.json

No 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.tsx

Usage

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

PropTypeDefaultWhat it does
linesreadonly LogStreamLine[]logStreamLinesLines to stream, in order. The set repeats from the top.
titlestring"Logs"Heading.
sourcestring"worker · staging"Where the log comes from, shown beside the heading.
commandstring"tail -f /var/log/worker.log"Command shown at the bottom right.
startTimestring"18:22:24"Time on the first row, as HH:MM:SS. Each later line is one second on.
intervalnumber700Milliseconds between lines. 0 holds the stream still.
pausedbooleanNoneSets whether the stream is paused from outside. Left out, the button changes it.
onPausedChange(paused: boolean) => voidNoneCalled with the new state when the button is pressed.
labelsPartial<LogStreamLabels>logStreamLabelsReplaces 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