#tui #terminal

tuirealm

A tui-rs framework to build tui interfaces, inspired by React and Elm

24 releases (13 stable)

Uses new Rust 2021

1.7.0 Jun 23, 2022
1.5.0 Mar 6, 2022
1.4.1 Dec 27, 2021
1.3.0 Nov 28, 2021
0.5.1 Jul 31, 2021

#26 in Command line utilities

Download history 267/week @ 2022-03-15 242/week @ 2022-03-22 84/week @ 2022-03-29 158/week @ 2022-04-05 94/week @ 2022-04-12 109/week @ 2022-04-19 374/week @ 2022-04-26 383/week @ 2022-05-03 487/week @ 2022-05-10 190/week @ 2022-05-17 267/week @ 2022-05-24 279/week @ 2022-05-31 142/week @ 2022-06-07 134/week @ 2022-06-14 183/week @ 2022-06-21 108/week @ 2022-06-28

603 downloads per month
Used in fewer than 7 crates

MIT license

255KB
5.5K SLoC

tui-realm

~ A tui-rs framework inspired by Elm and React ~

Get started · Standard Library · Documentation

Developed by @veeso

Current version: 1.7.0 (23/06/2022)

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

Crossterm CI Crossterm CI (Windows) Termion CI Coveralls Docs



About tui-realm 👑

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 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's 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 = "^1.7.0"

otherwise you can specify the features you want to add:

tuirealm = { version = "^1.7.0", default-features = false, features = [ "derive", "serialize", "with-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.
  • with-crossterm (default): use crossterm as backend for tui.
  • with-termion: use termion as backend for tui.

⚠️ You can enable only one backend at the time and at least one must be enabled in order to build.
❗ You don't need tui as a dependency, since you can access to tui types via use tuirealm::tui::

Enabling other backends ⚠️

When you want to switch to another backend (e.g. from crossterm to termion), remember that you MUST disable default features, in order to disable crossterm.

❗ You can never have more than one backend enabled at the same time

tuirealm = { version = "^1.7.0", default-features = false, features = [ "with-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

Dependencies

~2.2–8MB
~160K SLoC