Log Viewer
Scrollable log output component for displaying streaming logs or CLI-style output in web apps.
lucide-react
Loading...
Installation
$ shadcn add @jalco/log-viewerUsage
import { LogViewerTerminal } from "@/components/log-viewer"<LogViewerTerminal />Variants
Terminal
Full CLI-style interface with toolbar, line numbers, timestamps, search, copy, export, and pause/resume.
Terminal viewer
Application Logs40 lines
Filterable
Includes log-level toggle filters in the toolbar to quickly show/hide specific severities.
Filterable viewer
Filterable Logs34 / 40
Minimal
Lightweight, read-only variant without toolbars or controls. Just a scrollable log area.
Minimal viewer
API Reference
LogEntry
PropType
LogViewerTerminal
PropType
LogViewerMinimal
PropType
LogViewerFilterable
PropType
LevelColors
PropType
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" and aria-live="polite" so screen readers announce new entries. Filter toggles use role="checkbox" with aria-checked .
- No dependencies. Only requires React, Tailwind, lucide-react, and the
cnutility. - Icon library. Uses Lucide icons by default. Since this is copy-paste code, you can swap the imports if your project uses a different icon library.