Developed by Christian Visintin
Current version: 0.4.1 (11/06/2021)
tui-realm is a framework for tui to simplify the implementation of terminal user interfaces adding the possibility to work with re-usable components with properties and states, as you'd do in React But that's not all: the components communicate with the ui engine via a system based on Messages and events, providing you with the possibility to implement update
functions as happens in Elm. In addition, the components are organized inside Views, which manages mounting/umounting and focus for you.
And that's also explains the reason of the name: Realm stands for React and Elm.
Tui-realm also comes with a built-in standard library of components you may find very useful. Don't worry, they are optional if you don't want to use them 😉, just follow the guide in get started.
⚠ Warning: tui-realm works only with crossterm as backend ⚠
toml
tuirealm = "0.4.1"
or if you want to include the standard component library...
toml
tuirealm = { "version" = "0.4.1", features = [ "with-components" ] }
Since this library requires crossterm
too, you'll also need to add it to your Cargo.toml
toml
crossterm = "0.19.0"
You don't need tui as dependency, since you can access to tui via tuirealm::tui::*
View how to implement a tui-realm application in the related guide.
Still confused about how tui-realm works? Don't worry, try with the examples:
demo: a simple application which shows how tui-realm works
sh
cargo run --features="with-components" --example demo
Want to add yours? Open an issue using the New app/component
template 😄
Tui-realm comes with an optional standard library of components I thought would have been useful for most of the applications.
If you want to use it, just enable the with-components
feature in your Cargo.toml
.
For each component, the standard library provides a PropsBuilder
in the same module (e.g. input::Input => input::InputPropsBuilder
), which provides methods to set only the properties actually used by the component.
To have an overview of the components just run the gallery example 🦄
sh
cargo run --features="with-components" --example gallery
If you want a super-detailed guide about components check out the components guide.
These components are not included in tui-realm, but have been developed by other users. I like advertising other's contents, so here you can find a list of components you may find useful for your next tui-realm project 💜.
Want to add yours? Open an issue using the New app/component
template 😄
The developer documentation can be found on Rust Docs at https://docs.rs/tuirealm
As you've probably already noticed, tuirealm only supports crossterm
as backend for the terminal, even if tui
supports termion
and other libraries. Why this?
Well the reasons are these two:
Contributions, bug reports, new features and questions are welcome! 😉 If you have any question or concern, or you want to suggest a new feature, or you want just want to improve tui-realm, feel free to open an issue or a PR.
Please follow our contributing guidelines
View tui-realm's changelog HERE
If you like tui-realm and you're grateful for the work I've done, please consider a little donation 🥳
tui-realm is licensed under the MIT license.
You can read the entire license HERE