Skip to content

πŸ‘‘ A ratatui framework to build stateful applications with a React/Elm inspired approach

License

Notifications You must be signed in to change notification settings

veeso/tui-realm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

tui-realm

logo

~ A ratatui framework inspired by Elm and React ~

Get started Β· Standard Library Β· Documentation

Developed by @veeso

Current version: 2.0.3 (14/10/2024)

License-MIT Repo stars Downloads counter Latest version Ko-fi

Ratatui-Crossterm CI Ratatui-Termion CI Crossterm CI (Windows) Coveralls Docs



About tui-realm πŸ‘‘

tui-realm is a framework for ratatui 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 routines as happens in Elm. In addition, the components are organized inside the View, which manages mounting/umounting, focus and event forwarding for you.

And that also explains the reason of the name: Realm stands for React and Elm.

tui-realm also comes with a standard library of components, which can be added to your dependencies, that 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.

Demo

See tui-realm in action in the Example or if you want to read more about tui-realm start reading the official guide HERE.

Features 🎁

  • ⌨️ Event-driven
  • βš›οΈ Based on React and Elm
  • 🍲 Boilerplate code
  • πŸš€ Quick-setup
  • 🎯 Single focus and states management
  • πŸ™‚ Easy to learn
  • πŸ€– Adaptable to any use case

Get started 🏁

⚠️ Warning: currently tui-realm supports these backends: crossterm, termion

Add tui-realm to your Cargo.toml πŸ¦€

If you want the default features, just add tuirealm 1.x version:

tuirealm = "2"

otherwise you can specify the features you want to add:

tuirealm = { version = "2", default-features = false, features = [ "derive", "serialize", "termion" ] }

Supported features are:

  • derive (default): add the #[derive(MockComponent)] proc macro to automatically implement MockComponent for Component. Read more.
  • serialize: add the serialize/deserialize trait implementation for KeyEvent and Key.
  • crossterm: use the crossterm terminal backend
  • termion: use the termion terminal backend

Enabling other backends ⚠️

This library supports two backends: crossterm and termion, and two high level terminal TUI libraries: tui and ratatui. Whenever you explicitly declare any of the TUI library or backend feature sets you should disable the crate's default features.

❗ The two features can co-exist, even if it doesn't make too much sense.

Example using crossterm:

tuirealm = { version = "2", default-features = false, features = [ "derive", "crossterm" ]}

Example using the termion backend:

tuirealm = { version = "2", default-features = false, features = [ "derive", "termion" ] }

Create a tui-realm application πŸͺ‚

View how to implement a tui-realm application in the related guide.

Run examples πŸ”

Still confused about how tui-realm works? Don't worry, try with the examples:

  • demo: a simple application which shows how tui-realm works

    cargo run --example demo

Standard components library 🎨

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 add the tui-realm-stdlib to your Cargo.toml dependencies.

Community components 🏘️

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 πŸ˜„


Guides πŸŽ“


Documentation πŸ“š

The developer documentation can be found on Rust Docs at https://docs.rs/tuirealm


Apps using tui-realm πŸš€

Want to add yours? Open an issue using the New app/component template πŸ˜„


Support the developer β˜•

If you like tui-realm and you're grateful for the work I've done, please consider a little donation πŸ₯³

You can make a donation with one of these platforms:

ko-fi PayPal


Contributing and issues 🀝🏻

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


Changelog ⏳

View tui-realm's changelog HERE


License πŸ“ƒ

tui-realm is licensed under the MIT license.

You can read the entire license HERE