——— reactive terminal UI framework for rust ———
Why RxTUI?
Terminal UIs have traditionally been painful to build. You either work with low-level escape sequences or use immediate-mode libraries that require manual state management. RxTUI brings the retained-mode, component-based architecture that revolutionized web development to the terminal.
- Declarative UI - Describe what your UI should look like, not how to change it
- Component Architecture - Build complex apps from simple, reusable components
- Message-Based State - Elm-inspired architecture for predictable state updates
- Efficient Rendering - Virtual DOM with intelligent diffing minimizes redraws
- Rich Styling - Colors, borders, flexbox-style layout, text wrapping, and more
- Built-in Components - TextInput, forms, and other common UI elements
- Async Effects - First-class support for timers, API calls, and background tasks
Quick Start
use *;
;
Features
The node! Macro
Build UIs declaratively with a JSX-like syntax:
node!
Component System
Components manage their own state and handle messages:
;
Layout System
Flexbox-inspired layout with:
- Direction control (horizontal/vertical)
- Justify content (start, center, end, space-between, etc.)
- Align items (start, center, end)
- Wrapping support
- Percentage and fixed sizing
- Auto-sizing based on content
Rich Text Support
Create styled text with multiple segments:
node!
Async Effects
Handle background tasks with the effects system:
use Duration;
;
Examples
The examples directory contains comprehensive demonstrations:
- counter - Minimal interactive counter
- form - Text input and form handling
- stopwatch - Timer with effects
- align - Flexbox-style alignment
- components - Component composition
- demo - Full feature showcase
Run examples with:
Documentation
- API Documentation - Complete API reference
- GitHub Repository - Source code and issues
- Examples - Learn by example
Requirements
- Rust 1.70 or later
- Terminal with UTF-8 support
- Unix-like system (Linux, macOS) or Windows 10+
Optional Features
effects(default) - Async effects support with tokio
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.