tuil
ReferenceComponentsLogs, JSON, and diffs

CodeViewer

CodeViewer component API, behavior, and executable example.

View rawEdit

Loading executable example…

API and events

Inspect streaming logs, expandable structured values, and line-oriented changes in terminal-bounded viewports.

export function CodeViewer(props: CodeViewerProps): ReactNode;

Props, functions, and events

MemberTypeRequiredDescriptionRelated types
sourcestringYesThe source member uses the string contract.
languagestring | undefinedNoThe language member uses the string | undefined contract.
widthnumber | undefinedNoThe width member uses the number | undefined contract.
lineNumbersboolean | undefinedNoThe lineNumbers member uses the boolean | undefined contract.
themeCodeTheme | undefinedNoThe theme member uses the CodeTheme | undefined contract.CodeTheme
idstring | undefinedNoThe id member uses the string | undefined contract.
labelstring | undefinedNoThe label member uses the string | undefined contract.
autoFocusboolean | undefinedNoThe autoFocus member uses the boolean | undefined contract.
wrapboolean | undefinedNoThe wrap member uses the boolean | undefined contract.
horizontalOffsetnumber | undefinedNoThe horizontalOffset member uses the number | undefined contract.
foldedLinesReadonlySet<number> | undefinedNoThe foldedLines member uses the ReadonlySet<number> | undefined contract.
searchstring | RegExp | undefinedNoThe search member uses the string | RegExp | undefined contract.
clipboard&#123; write(value: string): void | Promise<void>; &#125; | undefinedNoThe clipboard member uses the &#123; write(value: string): void | Promise<void>; &#125; | undefined contract.
onCopy((value: string) => void | Promise<void>) | undefinedNoThe onCopy member uses the ((value: string) => void | Promise<void>) | undefined contract.
selectedLinenumber | undefinedNoThe selectedLine member uses the number | undefined contract.
onSelectedLineChange((line: number) => void | Promise<void>) | undefinedNoThe onSelectedLineChange member uses the ((line: number) => void | Promise<void>) | undefined contract.

LogViewer reports follow state; JSON expansion can be controlled; pure transformation helpers emit nothing.

Callback props run after the documented input is accepted. Callbacks are not cancellable unless their return type or description states otherwise.

Interaction and capabilities

Viewers scroll and filter; JSON nodes expand or collapse; diff output remains deterministic in static mode.

The published manifest records keyboard, focus, pointer, theme, terminal, semantic, event, and dependency requirements.

Complete import

import { CodeViewer } from "@/components/tuil/data-display/log-viewer";

On this page