Skip to content

ScrollbackView

Native scrollback root component. Uses the normal terminal buffer. Children flow vertically. As items scroll off the top, they transition through the virtualization lifecycle and are committed to terminal scrollback.

The user scrolls with their terminal's native scroll (mouse wheel, scrollbar, Shift+PageUp). Text selection is free. Content becomes part of the terminal's permanent history.

Import

tsx
import { ScrollbackView } from "silvery"

Props

PropTypeDefaultDescription
itemsT[]requiredArray of items to render
children(item: T, index: number) => ReactNode--Render function for each item
renderItem(item: T, index: number) => ReactNode--Alternative render function (prefer for memoization)
keyExtractor(item: T, index: number) => string | numberrequiredExtract a unique key for each item
isFrozen(item: T, index: number) => boolean--Data-driven frozen predicate
footerReactNode--Footer pinned at the bottom
maxHistorynumber10000Maximum lines in dynamic scrollback before promoting to static
markersboolean | ScrollbackMarkerCallbacks<T>--OSC 133 marker configuration
widthnumberprocess.stdout.columnsTerminal width in columns
stdout{ write(data: string): boolean }process.stdoutOutput stream
onRecovery() => void--Called on inconsistent state recovery

Usage

tsx
<ScrollbackView footer={<StatusBar />}>
  {messages.map(m => <Message key={m.id} data={m} />)}
</ScrollbackView>

// With item-level lifecycle control
<ScrollbackView
  items={tasks}
  keyExtractor={(t) => t.id}
  isFrozen={(t) => t.done}
  footer={<Text>Status bar</Text>}
>
  {(task) => <TaskItem task={task} />}
</ScrollbackView>

See Also

Released under the MIT License.