avatar
UI
Components
Changelog
LobeHub UI
Antd Components
Lucide Icons
CSSinJS
Ctrl
K
Chat
ChatInputArea
ChatItem
EditableMessage
Data Display
Card
ChatMarkdown
CollapseGroup
Descriptions
Highlighter
JsonViewer
LogViewer
ProCard
RichTextEditor
Status
Table
Tree
Data Entry
CodeEditor
Form
Mentions
MonacoEditor
SelectCard
SliderInput
Feedback
Alert
DragPanel
Drawer
Modal
Notification
General
Breadcrumb
Typography
WaveformIcon
Layout
Divider
Page
Navigation
ButtonGroup
Dropdown
Theme
ConfigProvider
Logo
TTS
useSpeechSynthes
Utils
FormHelper

LogViewer

React component that loads and views remote text in the browser lazily and efficiently. Logs can be loaded from static text, a URL, or a WebSocket and including ANSI highlighting. Based on @melloware/react-logviewer

import { LogViewer } from '@yuntijs/ui';
NPM
UNPKG
BundlePhobia
PackagePhobia
Anvaka Graph
Source
Edit
Previous
JsonViewer
Next
ProCard

Resources

Lobe UI-AIGC Components
Lobe Icon-AI / LLM Icon Collection
Lobe Charts-Modern Charts
Lobe TTS-TTS / STT Library

Community

Report Bug
Request Feature

Help

GitHub
Changelog

More Products

🤯 Lobe Chat-AI / LLM Chat Framework
🧸 Lobe Vidol-Virtual Idols for EveryOne
🅰️ Lobe Theme-Stable Diffusion Extension
🌐 Lobe i18n-AI i18next CLI
Copyright © 2022-2026
Made with ☁️ by YuntiJS
LobeHub

React component that loads and views remote text in the browser lazily and efficiently. Logs can be loaded from static text, a URL, or a WebSocket and including ANSI highlighting. Based on @melloware/react-logviewer

Usage

JSX
import { LogViewer } from '@yuntijs/ui';

const LogViewerDemo = () => {
  return (
    <LogViewer
      enableSearch
      extraLines={1}
      height={520}
      selectableLines
      url="https://gist.githubusercontent.com/helfi92/96d4444aa0ed46c5f9060a789d316100/raw/ba0d30a9877ea5cc23c7afcd44505dbc2bab1538/typical-live_backing.log"
    />
  );
};

export default ProCardDemo;

Demo

Playground

API

NameDescriptionTypeDefault
refreshIntervalTimed refresh, in ms, only takes effect when url is specified and not websocketnumber--
styleOptional custom inline style to attach to root virtual `LazyList` element.{}--
textString containing text to display.string--
urlThe URL from which to fetch content. Subject to same-origin policy, so must be accessible via fetch on same domain or via CORS.string--
onLoadExecute a function if/when the provided `url` has completed loading.()=>any--
onErrorExecute a function if the provided `url` has encountered an error during loading.(error:any)=>any--
onScrollCallback to invoke on user scroll. Args matches the ScrollFollow onScroll callback.(args:{ scrollTop: number; scrollHeight: number; clientHeight: number; })=>void--
heightSet the height in pixels for the component. Defaults to `'auto'` if unspecified. When the `height` is `'auto'`, the component will expand vertically to fill its container.string|number--
widthSet the width in pixels for the component. Defaults to `'auto'` if unspecified. When the `width` is `'auto'`, the component will expand horizontally to fill its container.string|number--
gutterThe Line Gutter componentReactNode[]--
caseInsensitiveFlag to enable/disable case insensitive searchboolean--
containerStyleOptional custom inline style to attach to element which contains the interior scrolling container.{}--
enableHotKeysIf true, capture system hotkeys for searching the page (Cmd-F, Ctrl-F, etc.)boolean--
enableGuttersEnable the line gutters to be displayed. Default is falseboolean--
enableLineNumbersEnable the line numbers to be displayed. Default is true.boolean--
enableLinksEnable hyperlinks to be discovered in log text and made clickable links. Default is false.boolean--
enableSearchEnable the search feature.boolean--
enableSearchNavigationIf true, search like a browser search - enter jumps to the next line with the searched term, shift + enter goes backwards. Also adds up and down arrows to search bar to jump to the next and previous result. If false, enter toggles the filter instead. Defaults to true.boolean--
enableMultilineHighlightEnable the ability to select multiple lines using shift + click. Defaults to true.boolean--
extraLinesNumber of extra lines to show at the bottom of the log. Set this to 1 so that Linux users can see the last line of the log output.number--
fetchOptionsOptions object which will be passed through to the `fetch` request. Defaults to `{ credentials: 'omit' }`.any--
followScroll to the end of the component after each update to the content. Cannot be used in combination with `scrollToLine`.boolean--
formatPartExecute a function against each string part of a line, returning a new line part. Is passed a single argument which is the string part to manipulate, should return a new string with the manipulation completed.(text:string)=>|string|number|unknown|ReactElement|unknown|ReactPortal|Promise<AwaitedReactNode>|boolean--
highlightLine number (e.g. `highlight={10}`) or line number range to highlight inclusively (e.g. `highlight={[5, 10]}` highlights lines 5-10). This is 1-indexed, i.e. line numbers start at `1`.number|Array--
highlightLineClassNameSpecify an additional className to append to highlighted lines.string--
lineClassNameSpecify an additional className to append to lines.string--
onHighlightExecute a function when the highlighted range has changed. Is passed a single argument which is an `Immutable.Range` of the highlighted line numbers.(range:Immutable.Seq.Indexed<number>)=>any--
onLineNumberClickAdditional function called when a line number is clicked. On click, the line will always be highlighted. This function is to provide additional actions. Receives an object with lineNumber and highlightRange. Defaults to null.(event:import("/src/LogViewer/types").LineNumberClickEvent)=>any--
onLineContentClickCallback to invoke on click of line contents.(event:React.MouseEvent<HTMLSpanElement, MouseEvent>)=>void--
overscanRowCountNumber of rows to render above/below the visible bounds of the list. This can help reduce flickering during scrolling on certain browsers/devices. Defaults to `100`.number--
rowHeightA fixed row height in pixels. Controls how tall a line is, as well as the `lineHeight` style of the line's text. Defaults to `19`.number--
scrollToLineScroll to a particular line number once it has loaded. This is 1-indexed, i.e. line numbers start at `1`. Cannot be used in combination with `follow`.number--
selectableLinesMake the text selectable, allowing to copy & paste. Defaults to `false`.boolean--
streamSet to `true` to specify remote URL will be streaming chunked data. Defaults to `false` to download data until completion.boolean--
websocketSet to `true` to specify that url is a websocket URL. Defaults to `false` to download data until completion.boolean--
websocketOptionsOptions object which will be passed through to websocket.{onOpen?:(e:Event,socket:any)=>void;onClose?:(e:any)=>void;onError?:(e:Event)=>void;formatMessage?:(message:any)=>string;reconnect?:boolean;reconnectWait?:number}--
className--string--
id--string--
0 matches
0 matches