Skip to content
Haze UI

Log viewer

Numbered, timestamped log lines with level labels, warning and error rows tinted, in a scrollable panel with an optional live status.

pnpm dlx shadcn@latest add @haze/log-viewer
Open preview in a new tab
Liveno JavaScript

When to use

  • An admin or developer tool shows a server's or a job's output
  • Readers need to spot warnings and errors in a stream of plain lines

When not to use

  • The content is a command to copy. Use snippet or code-block.
  • The panel imitates a shell session with prompts. Use terminal-window.

Installation

Add the Haze registry to components.json once, then install Log viewer with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/log-viewer
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
titlestring"web"Visible title; also names the scroll region.
sourcestring"pnpm dev --port 4321"Command or file the lines come from.
lines{ time?: string; level?: "debug" | "info" | "warn" | "error"; text: string }[]–Log lines, oldest first.
livebooleantrueShows a pulsing Live status for a running stream.
footerstring"Last 6 lines"Text of the footer band; empty hides it.
classstring–Additional classes on the panel.

Keyboard interactions

Tab, then arrow keys
Focus the log and scroll it.

Accessibility

  • The scroll region is focusable and named after the log, so keyboard users can scroll it.
  • Levels are read as words (warning, error); the three-letter codes and line numbers are hidden from assistive technology.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Log viewer" with `npx shadcn@latest add @haze/log-viewer`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import LogViewer from "@/components/haze/ui/log-viewer.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/log-viewer.md

  • Customize with real content

    Adapt the Haze log-viewer ui for our product. Replace the demo values of these props with our real content: title, source, lines, live, footer, class. Keep the layout, the heading level rules and these accessibility details: The scroll region is focusable and named after the log, so keyboard users can scroll it. Levels are read as words (warning, error); the three-letter codes and line numbers are hidden from assistive technology. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using log-viewer, check it fits: use it when an admin or developer tool shows a server's or a job's output; readers need to spot warnings and errors in a stream of plain lines. Avoid it when the content is a command to copy. use snippet or code-block.; the panel imitates a shell session with prompts. use terminal-window.. Alternatives: @haze/terminal-window, @haze/code-block, @haze/timeline.

Dependencies

  • @haze/status
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog