Skip to content

API Reference

Everything you need to build terminal UIs with Silvery.

Components

Layout

ComponentDescription
BoxFlexbox container — the building block for all layouts
TextStyled text with colors, bold, italic, underline, links
NewlineLine break between text elements
SpacerFlexible space that fills available room
StaticRenders content once, outside the rerender cycle

Interactive

ComponentDescription
SelectListKeyboard-navigable list with j/k, search, disabled items
TextInputSingle-line input with full readline shortcuts
TextAreaMulti-line text editor with selection and scrolling
ListViewVirtualized list for large datasets (replaces VirtualList)
TabsTab container with h/l keyboard navigation
CommandPaletteFuzzy-search command launcher (Ctrl+P / ⌘K style)

Display

ComponentDescription
TableData table with columns, alignment, and borders
SpinnerAnimated loading indicator (dots, line, arc, bounce)
ProgressBarDeterminate and indeterminate progress display

Deprecated

ComponentReplacement
VirtualListUse ListView instead

Functions

FunctionDescription
renderRender a React element to the terminal

Hooks

HookDescription
useBoxRectRead the current Box's committed rect (border-box minus padding/border)
useScrollRectScroll-adjusted rect — pre-sticky clamping
useScreenRectActual paint position on the terminal screen
useResponsiveBoxPropsDeclarative responsive <Box> prop spread (canonical primitive)
useResponsiveValuePick any value (string, enum, callback) by viewport breakpoint
useInputHandle keyboard and mouse input
useAppAccess the app instance (exit, rerender)
useStdoutAccess stdout for raw writes
Focus HooksFocus management (useFocusable, useFocusScope)

Term sub-owners

Typed facets of the Term abstraction — one owner per class of shared-global I/O state. See the I/O umbrella guide for the architecture.

OwnerDescription
term.inputSingle stdin mediator — probe() for terminal queries, onData() subscribers
term.outputstdout / stderr / console.* sink during alt-screen rendering
term.modesRaw mode, alt screen, bracketed paste, Kitty keyboard, mouse, focus
term.sizeReactive cols/rows with 16 ms resize coalescing (alien-signals)
term.consoleconsole.* capture + replay, complementary to term.output's sink

Quick Import

All exports come from one package:

tsx
import {
  Box,
  Text,
  SelectList,
  TextInput,
  TextArea,
  ListView,
  Tabs,
  Table,
  Spinner,
  ProgressBar,
  render,
  useBoxRect,
  useInput,
  useApp,
} from "silvery"