Add this component

npx zentauri-ui add console-viewer

Accessibility notes

Keyboard accessible by default with semantic markup, visible focus treatment, and tokenized states. Add descriptive labels for icon-only or decorative usage.

Dependency notes

Check Installation for shared peers. This component keeps styling in Tailwind classes and the --zui-* token contract.

Feedback

Console Viewer for displaying browser-style console output

Use the console viewer to render browser-style console output as a filterable, interactive widget. Pass an array of typed entries — log, info, warn, error, debug, dir, table, or group — and each renders with the appropriate icon and colour. Grouped entries can be collapsed/expanded. An optional toolbar lets users filter by entry type, clear the output, collapse all groups, or copy the full log to the clipboard.

ℹ️Zentauri UI library loaded successfully
ℹ️Building components…
⚠️Deprecated API: use `appearance` instead of `variant`
✖️Uncaught TypeError: Cannot read properties of undefined
at Component (file.tsx:42:12)
💾useEffect dependency array changed
ConsoleGroup (3)
└─
📋{ name: 'Zentauri', version: '1.0.0' }

Console viewer playground

Pick a session, chrome appearance, and size to preview the console viewer live. Toggle toolbar controls, switch on a motion preset, and use Show output / Show code to copy the matching snippet.


ℹ️Zentauri UI v1.0.0 initializing…
ℹ️Module federation enabled
ℹ️Registering 42 components
⚠️Theme provider missing — using defaults
💾Tree-shake candidates: 12 unused imports
ℹ️Rendered in 142ms

All appearances

Every shipped chrome appearance over the same session. Click any card to load it into the playground above.

default
ℹ️Zentauri UI v1.0.0 initializing…
ℹ️Module federation enabled
ℹ️Registering 42 components
⚠️Theme provider missing — using defaults
💾Tree-shake candidates: 12 unused imports
ℹ️Rendered in 142ms
subtle
ℹ️Zentauri UI v1.0.0 initializing…
ℹ️Module federation enabled
ℹ️Registering 42 components
⚠️Theme provider missing — using defaults
💾Tree-shake candidates: 12 unused imports
ℹ️Rendered in 142ms
contrast
ℹ️Zentauri UI v1.0.0 initializing…
ℹ️Module federation enabled
ℹ️Registering 42 components
⚠️Theme provider missing — using defaults
💾Tree-shake candidates: 12 unused imports
ℹ️Rendered in 142ms
glass
ℹ️Zentauri UI v1.0.0 initializing…
ℹ️Module federation enabled
ℹ️Registering 42 components
⚠️Theme provider missing — using defaults
💾Tree-shake candidates: 12 unused imports
ℹ️Rendered in 142ms

Console Viewer API

Generated from the package prop types and variant definitions.

ConsoleViewer

ConsoleViewerProps

Variants

PropTypeDefault
appearance
contrastdefaultglasssubtle
default
size
lgmdsm
md

Behavior

PropTypeDefault
defaultFilterConsoleEntryType[] | undefinednone
enableClearboolean | undefinednone
enableClipboardboolean | undefinednone
enableCollapseAllboolean | undefinednone
enableFilterboolean | undefinednone
entries*ConsoleEntry[]none
initiallyCollapsedboolean | undefinednone
labelsConsoleViewerLabels | undefinednone
Inherited HTML props
PropTypeDefault
classNamestring | undefinednone
idstring | undefinednone
onClickMouseEventHandler<HTMLDivElement> | undefinednone
styleCSSProperties | undefinednone
titlestring | undefinednone

ConsoleViewerVariant

ConsoleViewerVariantProps

Behavior

PropTypeDefault
appearance'default' | 'subtle' | 'contrast' | 'glass' | null | undefinednone
size'md' | 'sm' | 'lg' | null | undefinednone

ConsoleViewerAnimated

ConsoleViewerAnimatedProps

animated

Behavior

PropTypeDefault
animationConsoleViewerAnimation | undefinednone
appearance'default' | 'subtle' | 'contrast' | 'glass' | null | undefinednone
defaultFilterConsoleEntryType[] | undefinednone
enableClearboolean | undefinednone
enableClipboardboolean | undefinednone
enableCollapseAllboolean | undefinednone
enableFilterboolean | undefinednone
entries*ConsoleEntry[]none
initiallyCollapsedboolean | undefinednone
labelsConsoleViewerLabels | undefinednone
refAllows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).Ref<HTMLDivElement> | undefinednone
size'md' | 'sm' | 'lg' | null | undefinednone
Inherited HTML props
PropTypeDefault
classNamestring | undefinednone
idstring | undefinednone
onClickMouseEventHandler<HTMLDivElement> | undefinednone
styleCSSProperties | undefinednone
titlestring | undefinednone
CSS variable overrides

Console Viewer CSS variables

Override these console viewer variables on :root, a theme selector, or a component wrapper.

52 variables

Pattern: --zui-<component>-<slot?>-<variant?>-<property>-<state?>-dark?

:root {
  --zui-console-viewer-border: var(--zui-border,#0000001a);
  --zui-console-viewer-bg: var(--zui-surface,oklch(98.4% 0.003 247.858));
  --zui-console-viewer-fg: var(--zui-fg,oklch(20.8% 0.042 265.755));
  --zui-console-viewer-subtle-bg: var(--zui-surface-muted,oklch(92.9% 0.013 255.508));
  --zui-console-viewer-contrast-bg: #ffffff;
  --zui-console-viewer-glass-bg: #ffffffcc;
  --zui-console-viewer-glass-border: #ffffff66;
  --zui-console-viewer-toolbar-bg: var(--zui-surface-muted,oklch(96.8% 0.007 247.896));
  --zui-console-viewer-action-fg: var(--zui-fg-muted,oklch(44.6% 0.043 257.281));
  --zui-console-viewer-action-hover-bg: #0000000d;
  --zui-console-viewer-action-active-bg: #0000000d;
  --zui-console-viewer-log-fg: var(--zui-fg,oklch(20.8% 0.042 265.755));
  --zui-console-viewer-info-fg: #2563eb;
  --zui-console-viewer-warn-fg: #d97706;
  --zui-console-viewer-error-fg: #dc2626;
  --zui-console-viewer-debug-fg: #6b7280;
  --zui-console-viewer-dir-fg: #7c3aed;
  --zui-console-viewer-table-fg: #0d9488;
  --zui-console-viewer-group-fg: #2563eb;
  --zui-console-viewer-group-end-fg: #94a3b8;
  --zui-console-viewer-message-fg: var(--zui-fg,oklch(20.8% 0.042 265.755));
  --zui-console-viewer-meta-fg: #94a3b8;
  --zui-console-viewer-group-line: #0000001a;
  --zui-console-viewer-empty-fg: #94a3b8;
  --zui-console-viewer-count-fg: #ffffff;
  --zui-console-viewer-count-bg: #2563eb;
}

/* Dark theme variables follow the same names with -dark appended. */
.dark {
  --zui-console-viewer-border-dark: var(--zui-border-dark,#ffffff1a);
  --zui-console-viewer-bg-dark: var(--zui-surface-dark,oklch(12.9% 0.042 264.695));
}

Composition and API

Pass the session through the entries prop as an array of { type, message, stack?, count?, children? } entries, where type is log, info, warn, error, debug, dir, table, group, groupCollapsed, or groupEnd. The toolbar provides filter toggles for each type, a Clear button, a Collapse/Expand all toggle, and a Copy button. appearance switches between default, subtle, contrast, and glass chrome, and size controls the monospace text scale. The separate animated entry adds stagger and fade reveal presets for the body.

Accessibility

The toolbar controls are real buttons with aria-pressed for filter toggles and aria-expanded for group toggles. Group collapse/expand buttons are exposed as interactive controls. The root and every entry carry data-slot attributes for styling and testing, and each entry exposes a data-type attribute reflecting its kind. Colours ship light and dark pairs that meet contrast on their surfaces; the animated entry's motion is short and easing-based, so pair it with prefers-reduced-motion handling in your app where needed.

Next.js integration notes

The static ConsoleViewer entry ships no framer-motion and is safe in any Client Component tree (it manages local filter/clear state). The animated ConsoleViewerAnimated entry imports framer-motion, which is an optional peer dependency — install it only if you use the animated entry. Both render deterministically from the same entries, so server and client output match and there is no hydration mismatch.

FAQ

How do I add grouped console output?

Use group or groupCollapsed entries with a children array containing the nested entries. End the group with a groupEnd entry. The viewer renders a toggle arrow and indents children; groupCollapsed starts closed by default.

Can I disable the toolbar controls?

Yes. Each toolbar feature has a boolean prop: enableFilter, enableClear, enableCollapseAll, and enableClipboard. Set any to false to hide the corresponding control from the toolbar.

Do I need framer-motion?

Only for the animated entry. The default import from @zentauri-ui/zentauri-components/ui/console-viewer is framer-motion-free. Import ConsoleViewerAnimated from the /animated subpath when you want the stagger or fade reveal, and install framer-motion as a peer dependency.

How do I theme the entry colours?

Override the --zui-console-viewer-* CSS variables (bg, fg, border, toolbar-bg, log-fg, info-fg, warn-fg, error-fg, debug-fg, dir-fg, table-fg, group-fg, group-end-fg, message-fg, meta-fg, group-line, empty-fg, count-fg, count-bg, and more) on :root, a theme selector, or a wrapper. Each variable ships a light fallback and a paired -dark variant for dark mode.