# rtb-tui
> Part of the [phpboyscout Rust toolkit](https://rust.phpboyscout.uk),
> small, framework-free crates extracted from
> [rust-tool-base](https://gitlab.com/phpboyscout/rust-tool-base).
Reusable TUI widgets for CLI tools: a multi-step interactive `Wizard`
with escape-to-back navigation (backed by `inquire`), uniform
structured-output helpers (`render_table` / `render_json`) for a
`--output text|json` flag, and a TTY-aware `Spinner` that no-ops when
stderr isn't a terminal.
```rust
use rtb_tui::{render_table, render_json};
use serde::Serialize;
use rtb_tui::tabled::Tabled;
#[derive(Tabled, Serialize)]
#[tabled(crate = "rtb_tui::tabled")]
struct Row { name: &'static str, count: u32 }
let rows = vec![Row { name: "alpha", count: 1 }];
print!("{}", render_table(&rows)); // psql-style text table
print!("{}", render_json(&rows).unwrap()); // pretty-printed JSON array
```
## Documentation
- [Build a three-step wizard](https://tui.rust.phpboyscout.uk/tutorials/01-build-a-three-step-wizard/)
takes you from an empty crate to a working program.
- [How-to guides](https://tui.rust.phpboyscout.uk/how-to/) cover output
flags, progress reporting, exit codes and testing without a terminal.
- [Reference](https://tui.rust.phpboyscout.uk/reference/) has every
public item, its defaults and its failure modes.
- [What rtb-tui does not do](https://tui.rust.phpboyscout.uk/explanation/04-what-rtb-tui-does-not-do/)
lists the limitations. Read it before you plan around the crate.
This is not a full-screen terminal UI library. It draws no panels, has
no event loop, and there is no `ratatui` in its dependency graph. It
is three line-oriented widgets and nothing else.
- **Docs site:** <https://tui.rust.phpboyscout.uk>
- **Generated API docs:** <https://docs.rs/rtb-tui>
- **Crate:** <https://crates.io/crates/rtb-tui>
## Development
`just ci` runs the full local gate (fmt, clippy, nextest, doc, deny).
All tests run headless, with no TTY required. Releases are cut by
colophon from Conventional Commits, so do not tag manually.
## License
MIT