Getting Started
Everything you need to build terminal applications with Storm. From installation to production.
Installation
Storm requires Node.js 18+ and React 18+. Install the package from npm:
Or with your preferred package manager:
Peer dependencies: React 18+ and react-reconciler are required. Storm ships its own custom reconciler -- you do not need react-dom.
Your First App
Create a file called app.tsx and paste the following. This renders a bordered box with a spinner and styled text, and exits cleanly on Ctrl+C.
Run it with tsx or your preferred TypeScript runner:
How it works: render() enters the alternate screen buffer, sets up the cell-level diff renderer, and starts the React reconciler. waitUntilExit() returns a promise that resolves when exit() is called or the process receives SIGINT.
The Golden Rules
Storm's custom reconciler means some React patterns work differently. These three rules prevent the most common mistakes.
Use useRef + requestRender() for animation
React state updates go through the reconciler, which is too slow for scroll, animation, or live data. Mutate a ref and call requestRender() to trigger a direct paint + diff cycle.
Use useCleanup() for teardown
React's useEffect cleanup runs asynchronously, which can miss teardown in a terminal environment. Storm's useCleanup() runs synchronously before the component unmounts, ensuring timers, streams, and listeners are properly removed.
ScrollView needs a height or flex constraint
ScrollView virtualizes its children. Without a bounded height, it has no viewport to virtualize against and will render all items at once, defeating its purpose.
Components
Storm ships 92 components across 9 categories. Every component is designed for cell-level rendering -- no string concatenation, no ANSI escape hacks. See the full catalog at Components.
| Category | Count | Examples |
|---|---|---|
| Layout | 14 | Box, Flex, Grid, Spacer, Divider |
| Content | 12 | Text, Markdown, SyntaxHighlight, Link |
| Input | 11 | TextInput, Select, Checkbox, DatePicker |
| Data Display | 10 | Table, List, Tree, KeyValue |
| Feedback | 8 | Spinner, Progress, Toast, Badge |
| Navigation | 7 | Tabs, Breadcrumb, CommandPalette |
| Overlay | 6 | Modal, Drawer, Tooltip, ContextMenu |
| Visualization | 5 | LineChart, BarChart, Sparkline, Heatmap |
| AI / Agent | 19 | OperationTree, MessageBubble, CodeDiff |
Hooks
82 hooks organized into four tiers by frequency of use. Each tier builds on the previous -- start with Tier 0, reach for higher tiers as your app grows.
Essential
Used in every app
useTui
App context: exit(), requestRender(), dimensions
useInput
Keyboard and mouse event handler
useColors
Theme-aware color palette access
useTick
Imperative tick loop for animation
useCleanup
Synchronous teardown on unmount
Common
Used in most apps
useFocus
Focus management and tab ordering
useScroll
Imperative scroll offset control
useTerminal
Terminal size, capabilities, resize events
useAnimation
Tween and spring animation primitives
Interactive
Complex interactions
useBuffer
Direct cell-buffer access for custom rendering
useCommandPalette
Fuzzy-search command registration
useDragReorder
Keyboard-based drag-and-drop reordering
Headless
Logic-only behaviors -- bring your own UI
useSelectBehavior
Single/multi selection logic
useTreeBehavior
Expand/collapse tree navigation
useFormBehavior
Field validation, dirty tracking, submission
useListBehavior
Keyboard-navigable list with virtualization
Layout (Flexbox + Grid)
Storm implements a pure-TypeScript flexbox and CSS grid layout engine. Every Box is a flex container by default. Layout is computed in a single pass before painting to the cell buffer.
Supported layout props: flexDirection, flexGrow, flexShrink, flexBasis, flexWrap, alignItems, alignSelf, justifyContent, gap, padding, margin, width, height, minWidth, minHeight, maxWidth, maxHeight, overflow.
Theming
Storm includes 12 built-in themes and supports custom themes via createTheme(). Themes are applied through context and consumed by all components automatically.
Built-in Themes
Plugins
Plugins extend Storm with custom components, hooks, themes, and middleware. They support async setup, scoped effects, inter-plugin communication, and are sorted topologically by dependency.
SSH Serving
Serve your Storm app over SSH. Each connection gets its own isolated React tree with full keyboard, mouse, and resize support. Built-in authentication, rate limiting, and session management.
DevTools
Storm includes built-in time-travel DevTools. Enable them with a single line to get component inspection, render profiling, and frame-by-frame replay.
Full DevTools guide →Features
Component Tree Inspector
Browse the rendered component hierarchy with props and state.
Time-Travel Replay
Record frames and scrub through render history.
Render Profiler
Measure frame time, cell skip rate, and reconciler cost per component.
Accessibility Audit
Check focus order, screen reader labels, and contrast ratios.
Testing
Storm provides renderForTest() -- a headless renderer that captures cell-buffer output without needing a real terminal. Works with any test runner (Vitest, Jest, Node test runner).
Test utilities: lastFrame() returns the rendered text output. stdin.send() simulates keyboard input. frames() returns an array of all rendered frames for snapshot testing.