An open API service indexing awesome lists of open source software.

https://github.com/zerocore-ai/rxtui

reactive terminal interfaces for Rust. because CLIs deserve better.
https://github.com/zerocore-ai/rxtui

cli rust terminal tui

Last synced: 3 months ago
JSON representation

reactive terminal interfaces for Rust. because CLIs deserve better.

Awesome Lists containing this project

README

          



rxtui-dark


rxtui-light


———   reactive terminal UI framework for rust   ———




crates.io version


license


documentation


> [!WARNING]
>
> This project is in early development. APIs may change, and bugs may exist.

# WHY RXTUI?

Terminal UIs have traditionally been painful to build. You either work with low-level escape sequences (error-prone and tedious) or use immediate-mode libraries that require you to manage all state manually. **RxTUI** takes a different approach.

We bring the retained-mode, component-based architecture that revolutionized web development to the terminal:

- [x] **Declarative UI** - Describe what your UI should look like, not how to change it
- [x] **True Composability** - Build complex apps from simple, reusable components
- [x] **Best of Both Worlds** - Elm's message architecture meets React's components
- [x] **TUI Optimizations** - Automatic diffing, dirty tracking, and minimal redraws
- [x] **Inline Mode** - Render directly in terminal with persistent output for CLI tools



align demo


# QUICK START

### 1  Install RxTUI

Add to your `Cargo.toml`:

```toml
[dependencies]
rxtui = "0.1"
```

### 2  Create Your First App

A simple working example showing separation of state management and UI building:

```rust
use rxtui::prelude::*;

#[derive(Component)]
struct Counter;

impl Counter {
#[update]
fn update(&self, _ctx: &Context, msg: &str, mut count: i32) -> Action {
match msg {
"inc" => Action::update(count + 1),
"dec" => Action::update(count - 1),
_ => Action::exit(),
}
}

#[view]
fn view(&self, ctx: &Context, count: i32) -> Node {
node! {
div(
pad: 2,
align: center,
w_frac: 1.0,
gap: 1,
@key(up): ctx.handler("inc"),
@key(down): ctx.handler("dec"),
@key(esc): ctx.handler("exit")
) [
text(format!("Count: {count}"), color: white, bold),
text("use ↑/↓ to change, esc to exit", color: bright_black)
]
}
}
}

fn main() -> std::io::Result<()> {
App::new()?.run(Counter)
}
```

### 3  Run Your App

```bash
cargo run
```

counter demo

• • •

# DOCUMENTATION

| Document | Description |
| ----------------------------------------- | ------------------------------------------ |
| **[Examples](./examples)** | Collection of example apps |
| **[Documentation](DOCS.md)** | Complete framework documentation |
| **[Tutorial](TUTORIAL.md)** | Step-by-step guide from basics to advanced |
| **[API Reference](API_REFERENCE.md)** | Detailed API documentation |
| **[Quick Reference](QUICK_REFERENCE.md)** | Handy cheat sheet for common patterns |
| **[Implementation](IMPLEMENTATION.md)** | Internal architecture details |

• • •

# DEVELOPMENT

Want to contribute? We'd love to have you!

- **[Development Guide](DEVELOPMENT.md)** - Set up your dev environment
- **[Contributing](CONTRIBUTING.md)** - Contribution guidelines
- **[GitHub Issues](https://github.com/microsandbox/rxtui/issues)** - Report bugs or request features

• • •

# LICENSE

This project is licensed under the [Apache License 2.0](./LICENSE).