Skip to main content

Crate tui_kit

Crate tui_kit 

Source
Expand description

tui-kit — reusable TUI theme, widget frames, and layout helpers.

Built on top of ratatui. Designed to be shared across multiple terminal-UI projects that follow the same visual design language.

§Modules

ModuleContents
themeTheme struct — the full color/style palette
blockblock::panel_block, block::popup_block, block::widget_title, block::focusable_block
footerrender_footer, render_footer_with_app, keybind_spans — keybind bar
tabstabs::tab_line — horizontal tab-bar line for block titles
popuppopup::centered_popup — centered overlay area + Clear
leaderrender_leader_bar — vim-style leader key popup
mousemouse_hit — hit-test a click against a widget [Rect]
toastrender_toasts — stacked notification toasts
listlist::render_list — scrollable focusable list
treetree::render_tree — foldable hierarchical tree
formrender_form — multi-field input form
kvkv::render_kv_table — two-column key/value table

§Keybind bar convention

Every project should show a footer keybind bar using render_footer. The visual format is identical across all projects:

Navigate: j/k  |  Open: Enter  |  Leader: space  |  Quit: q

Keys are styled with Theme::shortcut_key (yellow), actions and separators with Theme::hint (dark gray).

Build pairs contextually based on the active UI layer (popup vs main screen):

let mut pairs: Vec<(&str, &str)> = Vec::new();
if some_popup_open {
    pairs.push(("Esc",   "close"));
    pairs.push(("Enter", "confirm"));
} else {
    pairs.push(("j/k",   "navigate"));
    pairs.push(("space", "leader"));
    pairs.push(("q",     "quit"));
}
render_footer(f, footer_area, &pairs, &theme);

Re-exports§

pub use block::render_scrollbar;
pub use footer::keybind_spans;
pub use mouse::list_item_at;
pub use mouse::mouse_hit;
pub use mouse::paragraph_line_at;
pub use form::FieldInput;
pub use form::FormEvent;
pub use form::FormField;
pub use form::FormState;
pub use form::FormStyle;
pub use form::error_lines;
pub use form::input_row;
pub use form::label_prefix;
pub use form::render_form;
pub use form::render_form_with;
pub use form::select_row;
pub use form::wrap_chars;
pub use kv::KvRow;
pub use leader::LeaderNode;
pub use leader::LeaderResult;
pub use leader::LeaderState;
pub use leader::render_leader_bar;
pub use list::ListItem;
pub use list::ListState;
pub use log::LogEntry;
pub use log::LogLevel;
pub use picker::PickerItem;
pub use picker::PickerState;
pub use picker::render_picker;
pub use theme::Theme;
pub use toast::Toast;
pub use toast::ToastLevel;
pub use toast::render_toasts;
pub use tree::TreeRow;
pub use tree::TreeState;
pub use tree::render_tree;
pub use wizard::ArrayEditSession;
pub use wizard::ArrayState;
pub use wizard::WizardEvent;
pub use wizard::WizardStep;
pub use wizard::WizardStepKind;
pub use wizard::WizardState;
pub use wizard::render_wizard;

Modules§

block
footer
Footer / keybind bar widget.
form
Multi-field input form with a stable two-column layout.
kv
leader
Vim-style leader key bar — generic, reusable across apps.
list
log
mouse
Mouse event helpers.
picker
Telescope-style two-column picker widget.
popup
tabs
theme
toast
tree
Foldable tree widget — a hierarchical, scrollable, focusable list.
wizard
Step-by-step wizard widget with tree-structured steps, optional steps, select (cycling) steps, and variable-length array steps.