tui_kit/lib.rs
1//! `tui-kit` — reusable TUI theme, widget frames, and layout helpers.
2//!
3//! Built on top of [ratatui](https://github.com/ratatui-org/ratatui).
4//! Designed to be shared across multiple terminal-UI projects that follow
5//! the same visual design language.
6//!
7//! ## Modules
8//!
9//! | Module | Contents |
10//! |------------|----------|
11//! | [`theme`] | [`Theme`] struct — the full color/style palette |
12//! | [`block`] | [`block::panel_block`], [`block::popup_block`], [`block::widget_title`], [`block::focusable_block`] |
13//! | [`footer`] | [`render_footer`], [`render_footer_with_app`], [`keybind_spans`] — keybind bar |
14//! | [`tabs`] | [`tabs::tab_line`] — horizontal tab-bar line for block titles |
15//! | [`popup`] | [`popup::centered_popup`] — centered overlay area + Clear |
16//! | [`leader`] | [`render_leader_bar`] — vim-style leader key popup |
17//! | [`mouse`] | [`mouse_hit`] — hit-test a click against a widget [`Rect`] |
18//! | [`toast`] | [`render_toasts`] — stacked notification toasts |
19//! | [`list`] | [`list::render_list`] — scrollable focusable list |
20//! | [`form`] | [`render_form`] — multi-field input form |
21//! | [`kv`] | [`kv::render_kv_table`] — two-column key/value table |
22//!
23//! ## Keybind bar convention
24//!
25//! Every project should show a footer keybind bar using [`render_footer`].
26//! The visual format is identical across all projects:
27//!
28//! ```text
29//! Navigate: j/k | Open: Enter | Leader: space | Quit: q
30//! ```
31//!
32//! Keys are styled with [`Theme::shortcut_key`] (yellow), actions and
33//! separators with [`Theme::hint`] (dark gray).
34//!
35//! Build pairs contextually based on the active UI layer (popup vs main screen):
36//!
37//! ```rust
38//! let mut pairs: Vec<(&str, &str)> = Vec::new();
39//! if some_popup_open {
40//! pairs.push(("Esc", "close"));
41//! pairs.push(("Enter", "confirm"));
42//! } else {
43//! pairs.push(("j/k", "navigate"));
44//! pairs.push(("space", "leader"));
45//! pairs.push(("q", "quit"));
46//! }
47//! render_footer(f, footer_area, &pairs, &theme);
48//! ```
49
50pub mod block;
51pub mod footer;
52pub mod form;
53pub mod kv;
54pub mod leader;
55pub mod list;
56pub mod log;
57pub mod mouse;
58pub mod picker;
59pub mod popup;
60pub mod tabs;
61pub mod theme;
62pub mod toast;
63pub mod wizard;
64
65pub use block::render_scrollbar;
66pub use footer::{keybind_spans, render_footer, render_footer_with_app};
67pub use mouse::{list_item_at, mouse_hit, paragraph_line_at};
68pub use form::{FieldInput, FormEvent, FormField, FormState, render_form};
69pub use kv::KvRow;
70pub use leader::{LeaderNode, LeaderResult, LeaderState, render_leader_bar};
71pub use list::{ListItem, ListState};
72pub use log::{LogEntry, LogLevel};
73pub use picker::{PickerItem, PickerState, render_picker};
74pub use theme::Theme;
75pub use toast::{Toast, ToastLevel, render_toasts};
76pub use wizard::{ArrayEditSession, ArrayState, WizardEvent, WizardStep, WizardStepKind, WizardState, render_wizard};