Examples
Explore Silvery's features through focused examples. Each page teaches a specific differentiator — click a demo to load it, keyboard input works inside the terminal.
By Feature
| Example | What it teaches | Key components |
|---|---|---|
| Components | 30+ ready-made widgets | SelectList, Tabs, ProgressBar, Spinner |
| Layout | CSS flexbox for terminals | Box, flexGrow, gap, justifyContent |
| Forms & Input | Interactive forms and wizards | SelectList, TextInput, focusScope |
| Tables & Data | Data exploration and filtering | Table, VirtualList, useContentRect() |
| Scrollback | Dynamic inline mode (unique) | ScrollbackList, ScrollbackView |
| Terminal Protocols | Kitty keyboard, mouse, images | Image, Canvas, parseHotkey() |
| AI Coding Agent | Streaming and real-time updates | VirtualList, TextInput, tool calls |
| Testing | Headless testing API | createRenderer, press(), getByText() |
Running Examples
Clone the repository and run any example:
bash
git clone https://github.com/beorn/silvery
cd silvery
bun install
# Run the example viewer (Storybook-style TUI):
bun examples
# Run a specific example:
bun examples/interactive/aichat/index.tsx
bun examples/interactive/cli-wizard.tsx
bun examples/layout/dashboard.tsxCreating Your Own
Start with the example closest to your use case:
| Use Case | Start With |
|---|---|
| Interactive form / wizard | Forms & Input |
| Data table with search | Tables & Data |
| Multi-pane dashboard | Layout |
| Chat / streaming UI | AI Coding Agent |
| CLI tool with scrollback | Scrollback |
All examples follow the same patterns:
- Use
SelectListfor selection prompts (not manual cursor tracking) - Use
TextInputfor text entry (built-in readline with Emacs keybindings) - Use
useContentRect()for responsive dimensions - Use
overflow="scroll"+scrollTofor scrolling - Use
$tokencolors for consistent theming