# tui-realm
~ A ratatui framework inspired by Elm and React ~
Get started ยท Standard Library ยท Documentation
Developed by @veeso
Current version: 2.0.3 (14/10/2024)
--- - [tui-realm](#tui-realm) - [About tui-realm ๐](#about-tui-realm-) - [Features ๐](#features-) - [Get started ๐](#get-started-) - [Add tui-realm to your Cargo.toml ๐ฆ](#add-tui-realm-to-your-cargotoml-) - [Enabling other backends โ ๏ธ](#enabling-other-backends-๏ธ) - [Create a tui-realm application ๐ช](#create-a-tui-realm-application-) - [Run examples ๐](#run-examples-) - [Standard components library ๐จ](#standard-components-library-) - [Community components ๐๏ธ](#community-components-๏ธ) - [Guides ๐](#guides-) - [Documentation ๐](#documentation-) - [Apps using tui-realm ๐](#apps-using-tui-realm-) - [Support the developer โ](#support-the-developer-) - [Contributing and issues ๐ค๐ป](#contributing-and-issues-) - [Changelog โณ](#changelog-) - [License ๐](#license-) --- ## About tui-realm ๐ tui-realm is a **framework** for **[ratatui](https://github.com/ratatui-org/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](#get-started-). ![Demo](/docs/images/demo.gif) See tui-realm in action in the [Example](#run-examples-) or if you want to read more about tui-realm start reading the official guide [HERE](docs/en/get-started.md). ## 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: ```toml tuirealm = "2" ``` otherwise you can specify the features you want to add: ```toml 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](https://github.com/veeso/tuirealm_derive). - `serialize`: add the serialize/deserialize trait implementation for `KeyEvent` and `Key`. - `crossterm`: use the [crossterm](https://github.com/crossterm-rs/crossterm) terminal backend - `termion`: use the [termion](https://github.com/redox-os/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: ```toml tuirealm = { version = "2", default-features = false, features = [ "derive", "crossterm" ]} ``` Example using the termion backend: ```toml 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](/docs/en/get-started.md). ### Run examples ๐ Still confused about how tui-realm works? Don't worry, try with the examples: - [demo](/examples/demo/demo.rs): a simple application which shows how tui-realm works ```sh 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](https://github.com/veeso/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 ๐. - [tui-realm-textarea](https://github.com/veeso/tui-realm-textarea) A textarea/editor component developed by [@veeso](https://github.com/veeso) - [tui-realm-treeview](https://github.com/veeso/tui-realm-treeview) A treeview component developed by [@veeso](https://github.com/veeso) Want to add yours? Open an issue using the `New app/component` template ๐ --- ## Guides ๐ - [Get Started Guide](/docs/en/get-started.md) - [Advanced concepts](/docs/en/advanced.md) --- ## Documentation ๐ The developer documentation can be found on Rust Docs at