Expand description
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.
tui-realm also comes with a standard library of components, that you may find very useful.
The stdlib can be found in tui-realm-stdlib
Β§Get started π
Β§Add tui-realm to your Cargo.toml π¦
If you want the default features:
tuirealm = "4"Alternatively you can specify the features you want to add:
tuirealm = { version = "4", default-features = false, features = [ "derive", "serialize", "crossterm" ] }Supported features are:
derive(default): add the#[derive(Component)]proc macro to automatically implementComponentforAppComponent. Read more.async-ports: add support for async portsserialize: add the serialize/deserialize trait implementation forKeyEventandKey.crossterm(default): enable the crossterm terminal backendtermion: enable the termion terminal backendtermwiz: enable the termwiz terminal backend
Β§Create a tui-realm application πͺ
You can read the Get Started guide guide on github.
Β§Run examples π
Still confused about how tui-realm works? Donβt worry, try with the examples:
- demo: a simple example that shows basic tui-realm usage
- user-events: showcase using custom events
- inline-display: showcase how tui-realm can be used without requiring a alternate screen
- async-ports: showcase usage of async ports
- arbitrary-data: showcase usage of
PropPayload::Anyto send custom data acrossqueryandattr
ModulesΒ§
- application
- This module exposes the
Application, the core oftui-realmand its directly related types. - command
- This module exposes the
Cmdtype, which must be used when sending commands to theComponentfrom theAppComponentafter anEvent. - component
- This module exposes the component traits
- event
eventscontains all the types related toEvent.- injector
- properties injector
- listener
- This module exposes everything required to run the event listener which handles Input and custom events in a tui-realm application.
- props
- The
propsmodule exposes the Properties supported by the components and all the values they can get. - ratatui
ratatuijust exposesratatuiitself, so that users oftui-realmdont have to install ratatui on their own and potentially have confliciting versions.- state
- This module exposes the state type and values
- subscription
- This module defines the model for the Subscriptions
- terminal
- All render and input backends
- testing
- Utilities for snapshot and rendering tests.
- utils
- This module exposes utilities
- view
- This module exposes the View structure, which is the wrapper for all the components in an application.
MacrosΒ§
- subclause_
and - A macro to generate a chain of
crate::subscription::SubClause::AndManyfrom a list of Ids with the casecrate::subscription::SubClause::IsMountedfor every id. - subclause_
and_ not - A macro to generate a chain of
crate::subscription::SubClause::Andfrom a list of Ids with the casecrate::subscription::SubClause::Notcontainingcrate::subscription::SubClause::IsMountedfor every id. - subclause_
or - A macro to generate a chain of
crate::subscription::SubClause::OrManyfrom a list of Ids with the casecrate::subscription::SubClause::IsMountedfor every id.
Attribute MacrosΒ§
- async_
trait async-ports