Log Stream
ProThe timestamped lines a run writes, newest at the bottom, with an All or Errors filter and auto-scroll.
Playground
Run log
Run log
Run log
Nothing logged yet.
Installation
Log Stream comes with WunderUI Core and Pro, in the package from your plan. See the plans.
Then import what you need:
import { LogStream } from "@wunderui/react"Then use it:
import { LogStream } from "@wunderui/react"
const LINES = [
{ id: "1", time: "0:01.4", level: "info", message: "Read 214 variables from Figma" },
{ id: "2", time: "0:05.2", level: "warn", message: "Figma API busy, retrying in 2 s" },
{ id: "3", time: "0:12.0", level: "error", message: "Push to docs-preview timed out" },
] as const
export function RunLog() {
return <LogStream lines={[...LINES]} />
}Expected result: You see a card titled Run log with All and Errors on the right, three lines with times, a Warn and an Error word, and Auto-scroll at the bottom. Press Errors and only the last line stays.
When to use
Use Log Stream for
- The timestamped lines a run writes while it works, newest at the bottom
- A log that keeps growing while the reader follows it, or reads back
- Finding the failure in a long run with the Errors filter
Use something else for
- Terminal Output for one command with its exit code and its output streams
- Run Timeline for the steps of a run with their duration and result
- Activity Item for one line per action, with a status, a tool and a time
Level
A line is debug, info, warn or error. Info shows only a grey dot, the others add the level word before the message, and screen readers hear every level, info included.
Run log
Run log
Run log
Run log
Filter
All shows every line, Errors only the error lines, so a warning does not pass. To know what is shown, control the filter from the page.
Run log
Run log
Run log
No errors so far.
Auto-scroll
While Auto-scroll is on, every new line pulls the view to the bottom; turn it off to read back while the log keeps growing below. It does not switch off by itself when the reader scrolls.
Run log
Run log
Empty
An empty log says so, and a filter that leaves nothing says that. Both messages sit inside the log region, and you can replace them.
Run log
Nothing logged yet.
Run log
No errors so far.
Run log
Waiting for the run to start
Line
The time column is 46 px wide, so keep it to run times like 0:02.9 or clock times like 14:02:11. The message wraps.
Run log
Run log
Run log
Run log
figma-tokens.json with 214 variablesKeyboard interactions
The filter and Auto-scroll are native buttons. The log is a focusable scroll region, so the usual scroll keys work.
- TaborShift+Tab
- Moves focus through All, Errors, the log and Auto-scroll, in that order. Focus shows as an indigo ring.
- EnterorSpace
- On All or Errors: shows that set of lines. On Auto-scroll: turns it on or off. follows.
- ArrowDownorArrowUp
- In the focused log: scrolls it by a line.
- PageDownorPageUp
- In the focused log: scrolls it by a page.
- HomeorEnd
- In the focused log: jumps to the oldest or the newest line.
Behavior and motion
What the log does with its lines, the filter, scrolling, assistive technology and motion.
- Lines
- Every line you pass is rendered in order, newest last. The array is the whole log, and each line needs an id so rows keep their identity.
- Limits
- There is no cap and no virtualisation: each line is a DOM node. Keep the newest 200 to 500 lines in your own buffer; the log still scrolls to the newest one.
- Filter
- All shows every line, Errors only error lines (a warning does not pass). The filter never changes your lines, and there is no search, so filter first.
- Auto-scroll
- While on, each new array of lines and each filter change scrolls to the bottom. It does not notice the reader, so scrolling up gets pulled back by the next line unless you turn it off.
- Live region
- The log is a polite live region, so added lines are read after the current speech: time, level word and message. Removed lines are not read.
- Empty
- With no lines, or none that pass the filter, the log says Nothing logged yet or No errors so far. An empty label prop replaces both.
- Failure
- The log has no state for a failed, stopped or dropped stream. Add a final error or warn line and say it in text next to the log.
- States
- Filter buttons tint on hover and when pressed, and Auto-scroll darkens its text on hover. Buttons and the log show an indigo ring on keyboard focus.
- Motion
- The component has no animation. Lines appear at once and the view jumps to the bottom; buttons change colour quickly.
- Reduced motion
- Nothing moves, so there is nothing to reduce. With reduced motion only the colour changes remain, and they carry no meaning by themselves.
Anatomy
The figure marks a log with a failed run. Time, level and message are the three parts of every line and have no number of their own.
Run log
- data-slot="log-stream"
A section named by its title with a 1 px border and 16 px radius: title and filter in a row, the log, and the Auto-scroll toggle.
- 1
The title (Run log by default) in one line of 15 px semibold text. It names the section and the log.
- 2
A group named Show with two toggle buttons, All and Errors. Control the level yourself or let the component keep it.
- 3
The scrolling region: a live log named by the title that a keyboard can scroll. It stops growing at the maximum height, 240 px by default.
- 4Optional
One row with the time, a level dot, the level word and the message. Give each line an id; without one, rows are keyed by position.
The time of the line, already formatted, in 11 px tabular numbers in a 46 px column.
A 6 px dot and the level word. Debug, warn and error show the word, info hides it visually, and screen readers read it for every level.
The message in 13 px text, using the free width. It wraps and breaks long words.
- 5
A button with a pin icon, on by default. Control it yourself or let the component keep the state.
Best practices
- Do
Pass the time already formatted and short, such as 0:02.9 or 14:02:11, and give every line a stable id. The time column is 46 px wide.
- Do
Cap the array to the newest 200 to 500 lines and create a new array only when a line arrives. The log renders every line and does not virtualise.
- Do
Mark failed lines with the error level. The Errors filter shows only those, and an empty result reads No errors so far.
- Do
Say how the stream ended, in a line and in text next to the log: failure, stop or dropped connection. A stalled log looks like a quiet one.
- Do
Give every Log Stream on a page its own title. Two landmarks with the same name cannot be told apart.
- Do
Control auto-scroll when readers should be left alone while reading back. The log never turns it off by itself.
- Don’t
Don't append lines faster than a person can read. A polite live region queues announcements, so batch one second of lines into one.
- Don’t
Don't pass HTML strings or untrusted markup as a message. Log lines come from tools and files, so render them as text.
- Don’t
Don't expect search, copy or a line cap from the component. They belong to the page around it, as the Examples tab shows.
API reference
LogStream is a plain component, so this table lists every prop.
A section named by its title with a 1 px border and 16 px radius: title and filter in a row, the log, and the Auto-scroll toggle.
| Prop | Type | Default | Description |
|---|---|---|---|
| lines required | LogLine[] | — | The lines, oldest first. Each has a (already formatted), a (text or parts), an optional (, , , ; default ) and an optional used as the row key. |
| title | ReactNode | "Run log" | The heading of the card and the name of the log region. Default . |
| level | "all" | "errors" | — | Controlled filter, or . Pass it with ; without it the filter keeps its own state. |
| defaultLevel | "all" | "errors" | "all" | The filter the log starts with when it is not controlled. Default . |
| onLevelChange | (level) => void | — | Called with or when a filter button is pressed, controlled or not. |
| autoScroll | boolean | — | Controlled Auto-scroll. Pass it with , for example to turn it off when the reader scrolls up. |
| defaultAutoScroll | boolean | true | Whether Auto-scroll starts on when it is not controlled. Default . |
| onAutoScrollChange | (autoScroll) => void | — | Called with the new value when the Auto-scroll button is pressed, controlled or not. It is not called when the log scrolls. |
| maxHeight | number | 240 | The height in px after which the log scrolls. Default . |
| emptyLabel | ReactNode | — | Shown when no line passes the filter, in place of and |
| className | string | — | Extra classes for the card, for example a width. |
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("log-stream")The full library index for assistants is at /llms.txt.
Related components
- $
pnpm vitest run invoiceexit 03.8 sRUN v3.2.4 /srv/wunderui
✓ src/jobs/invoice-reminders.test.ts (6 tests) 412 ms
✓ src/jobs/reminder-template.test.ts (3 tests) 98 ms
Test Files 2 passed (2)
Tests 9 passed (9)
Duration 3.8 s
AI & Agents4 stylesProTerminal OutputThe result of a code-execution tool call: command, exit code, run time, stdout and stderr. - Done420 tok$0.01640ms
Input
status: overdue, age: 30+ daysOutput
14 invoices, $42,860 in total - Done3,420 tok$0.042.1s
Input
14 invoice idsOutput
14 contacts, all with an email address - Running2,310 tok
Input
template: invoice-overdue-30 - Pending
Input
to: 14 recipients - PendingLog the result
AI & Agents5 stylesProRun TimelineEvery step of a run in order, with duration, tokens and expandable input/output.- Running: Comparing Figma and code tokenstokens.diff6.3sDone: Read 214 variables from Figmafigma.read3.6sFailed: Push to docs-preview timed out after 30 sgithub.push30.0sWaiting: Waiting for the previous step—AI & Agents4 stylesProActivity ItemOne line in a live activity stream: status, action, tool and elapsed time.