tui
A lightweight, composable terminal UI library for building full-screen CLI apps.
Core Primitives
Component— trait for reusable widgets with event handling and renderingEvent— unified input events (key, paste, mouse, tick, resize)Frame— rendered output: lines + cursor positionLayout— vertical section composition into aFrameRenderer— efficient diff-based terminal renderer (feature:runtime)TerminalSession— raw-mode lifecycle management (feature:runtime)
Quick Start
The library provides composable building blocks — your app owns its event loop and state machine.
use ;
// Define your app state and use Component for child widgets
Convert crossterm events with Event::try_from(crossterm_event) — it filters key releases and maps resize events automatically.
Built-in Widgets
Panel— bordered containerForm,TextField,NumberField— form inputsCheckbox,RadioSelect,MultiSelect— selection controlsSelectList— scrollable list with selectionSpinner— animated progress indicatorCombobox— fuzzy-searchable picker (feature:picker)FocusRing— Tab/BackTab focus traversal
Feature Flags
| Feature | Description | Default |
|---|---|---|
syntax |
Syntax highlighting via syntect | yes |
picker |
Fuzzy combobox picker | yes |
testing |
Test utilities (TestTerminal, render_component) |
no |
Disable defaults for lower-level use:
[]
= { = "0.1", = false }
License
MIT