Quick Start
Install
Section titled “Install”npm install bettertui@latestProject Files
Section titled “Project Files”src/App.tsx
Section titled “src/App.tsx”import { Box, Text, useInput } from '@bettertui/react';
export default function App() { const [count, setCount] = useState(0);
useInput((key) => { if (key === '+') setCount(c => c + 1); if (key === '-') setCount(c => c - 1); if (key === 'q') process.exit(0); });
return ( <Box flexDirection="column" padding={1}> <Text bold color="cyan"> BetterTUI Counter </Text> <Text>Count: {count}</Text> <Text dimColor> +/- to adjust • q to quit </Text> </Box> );}src/index.tsx
Section titled “src/index.tsx”import { render } from '@bettertui/react';import App from './App';
render(<App />);pnpm devWhat Happens
Section titled “What Happens”- React renders your component tree
- The custom reconciler diffs the tree
- Changed nodes produce render commands
- Commands are sent to the Rust engine via napi-rs
- The engine renders to the terminal at 60fps
Next Steps
Section titled “Next Steps”- Components — Explore the widget library
- Theming — Customize the look
- API Reference — Full API docs