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
useContentRectGet component dimensions during render (container queries for terminals)
useInputHandle keyboard and mouse input
useAppAccess the app instance (exit, rerender)
useStdoutAccess stdout for raw writes
Focus HooksFocus management (useFocusable, useFocusScope)

Quick Import

All exports come from one package:

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

Released under the MIT License.