TuiIntroduction
Introduction
React-based TUI library powered by a native Rust diff engine, drop-in Ink-compatible API
@visulima/tui
React-based terminal UI library powered by a native Rust diff engine.
@visulima/tui provides a component-driven TUI framework with an Ink-compatible API, a high-performance Rust diff renderer, and first-class support for React hooks, Yoga layout, mouse events, scrolling, and raw-buffer rendering.
Key Features
- Ink-compatible API — Drop-in replacement for most Ink component and hook usage
- Rust diff engine — Native NAPI binding emits only changed terminal cells as ANSI
- Three rendering modes — React, raw-buffer, and inline mode
- Full hook set — Input, paste, mouse, focus, scrollable, text input, window size
- Ratatat-only extras —
<Spinner>,<ProgressBar>,useMouse,useScrollable,useTextInput - TypeScript first — Full type safety with exported types
Quick Start
import { render, Box, Text, useInput } from "@visulima/tui/react";
import React, { useState } from "react";
function Counter() {
const [count, setCount] = useState(0);
useInput((_input, key) => {
if (key.upArrow) setCount((c) => c + 1);
if (key.downArrow) setCount((c) => c - 1);
});
return (
<Box flexDirection="column" padding={1}>
<Text bold color="cyan">
Counter
</Text>
<Text>Count: {count}</Text>
<Text dim>↑↓ to change · Ctrl+C to exit</Text>
</Box>
);
}
render(<Counter />);Next Steps
Getting Started
Installation, requirements, and mode selection
Quickstart: React
Build your first TUI app with React components
Quickstart: Raw Buffer
Drive the Rust renderer directly without React
Components
Box, Text, Static, Spinner, ProgressBar, and more
Hooks
Input, mouse, focus, scrollable, and other hooks
API Reference
Ink compatibility matrix and Ratatat-only exports