API Reference
Everything you need to build terminal UIs with Silvery.
Components
Layout
| Component | Description |
|---|---|
| Box | Flexbox container — the building block for all layouts |
| Text | Styled text with colors, bold, italic, underline, links |
| Newline | Line break between text elements |
| Spacer | Flexible space that fills available room |
| Static | Renders content once, outside the rerender cycle |
Interactive
| Component | Description |
|---|---|
| SelectList | Keyboard-navigable list with j/k, search, disabled items |
| TextInput | Single-line input with full readline shortcuts |
| TextArea | Multi-line text editor with selection and scrolling |
| ListView | Virtualized list for large datasets (replaces VirtualList) |
| Tabs | Tab container with h/l keyboard navigation |
| CommandPalette | Fuzzy-search command launcher (Ctrl+P / ⌘K style) |
Display
| Component | Description |
|---|---|
| Table | Data table with columns, alignment, and borders |
| Spinner | Animated loading indicator (dots, line, arc, bounce) |
| ProgressBar | Determinate and indeterminate progress display |
Deprecated
| Component | Replacement |
|---|---|
| VirtualList | Use ListView instead |
Functions
| Function | Description |
|---|---|
| render | Render a React element to the terminal |
Hooks
| Hook | Description |
|---|---|
| useContentRect | Get component dimensions during render (container queries for terminals) |
| useInput | Handle keyboard and mouse input |
| useApp | Access the app instance (exit, rerender) |
| useStdout | Access stdout for raw writes |
| Focus Hooks | Focus 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"