cocotte
A convenient way to build Ratatui terminal applications by composing independent sub-apps.
Inspiration
--- You look sad, Grug. What is the matter?
--- Grug likes Ratatui. But Ratatui big! When Grug uses Ratatui, it takes all place in Grug's brain! Grug cannot do the things anymore!
--- Well Grug, you know, it's normal, tuis are kinda complicated when you think about it and...
--- Grug do not care! Grug only wants to care about what the little pieces do!
--- Mhhm. I think I know what you need, Grug. You need a Cocotte!
--- What is Cocotte?
--- A Cocotte is a good way to make a good Ratatui.
--- Is it dumb?
--- Yes Grug, do not worry.
Presentation
Split your TUI into vertical panes. Each pane handles its own input, rendering and manages its state. Each pane also manages the shared app state.
+-----------------------------+
| Input (Constraint::Length) |
+-----------------------------+
| |
| Browser (Constraint::Fill) |
| |
+-----------------------------+
Usage
Add to Cargo.toml:
[]
= "0.1"
Define an event type, a state type, one or more SubApp implementations, then wire them together with define_sub_apps!:
use ;
use Result;
use Frame;
use ;
use ;
use ;
;
define_sub_apps!
See examples/simple (cargo run --example simple) for a full file-browser example.
References
Grug by https://grugbrain.dev/
License
MIT