Log Viewer
Scrollable log output component for displaying streaming logs or CLI-style output in web apps. Three variants — terminal, minimal, and filterable — cover most log display needs.
Preview
Installation
$ shadcn add https://ui.justinlevine.me/r/log-viewer.jsonUsage
import { LogViewerTerminal, LogViewerMinimal, LogViewerFilterable } from "@/components/log-viewer"<LogViewerTerminal entries={logs} title="Server Logs" />Pass an array of { level, message, timestamp? } entries. All three variants support auto-scrolling and accept the same LogEntry format.
Playground
Switch between variants and click Start streaming to see auto-scroll in action.
Variants
Terminal
Full CLI-style interface with toolbar, line numbers, timestamps, search, copy, export, and pause/resume.
Default terminal
No line numbers, no timestamps
Minimal
Simple scrolling log lines with colored dots. Ideal for compact panels, sidebars, or embedded contexts.
Minimal with timestamps
Minimal without timestamps
Filterable
Adds level filter toggles with live counts and inline search. Toggle levels on/off to focus on errors or warnings.
Filterable with all levels
Custom colors
Pass a colorScale to override colors per level. Only specify the levels you want to change — the rest fall back to defaults.
Ocean
Warm
Real-world example
A realistic CI/CD deploy log using the terminal variant.
Deploy pipeline
API Reference
LogEntry
LogViewerTerminal
LogViewerMinimal
LogViewerFilterable
LevelColors
Notes
- Client component. Uses
"use client"for scroll tracking, search state, and clipboard access. - Auto-scroll. New entries scroll into view when the user is at the bottom. Scrolling up pauses auto-scroll and shows a "New logs below" button. The terminal variant also has an explicit pause/resume toggle.
- Five log levels. Each level (error, warn, info, debug, verbose) has distinct colors that work in both light and dark modes.
- Export. The terminal and filterable variants include a download button that exports logs as a plain text file with timestamps and level labels.
- Search highlighting. Search matches are highlighted inline. In the filterable variant, search and level filters compose — only entries matching both are shown.
- Accessibility. The log container uses
role="log"andaria-live="polite"so screen readers announce new entries. Filter toggles userole="checkbox"witharia-checked. - No dependencies. Only requires React, Tailwind, lucide-react, and the
cnutility. No virtual-scrolling library — suitable for log sets up to a few thousand entries.