Skip to main content

Crate ratatui_toolkit

Crate ratatui_toolkit 

Source
Expand description

§ratatui-toolkit

A comprehensive collection of reusable TUI components for ratatui, the Rust terminal UI library.

§Overview

This crate provides production-ready, reusable widgets for building terminal user interfaces:

§Feature Flags

The crate uses feature flags to minimize dependencies:

FeatureDefaultDescription
markdownYesMarkdown rendering support
treeYesTree view widget
dialogYesModal dialog components
toastYesToast notification system
splitYesResizable split panels
menuYesMenu bar component
statusbarYesStatus bar components
hotkeyYesHotkey footer and modal
terminalNoTerminal emulators (AlacTerm, VT100)
fuzzyNoFuzzy finder component
master-layoutNoFull application layout framework
file-treeNoFile system tree with devicons
fullNoEnable all features

§Quick Start

use ratatui::prelude::*;
use ratatui_toolkit::prelude::*;

// Create a resizable split
let split = ResizableSplit::new(30); // 30% left, 70% right

// Create a toast notification
let mut manager = ToastManager::new();
manager.success("File saved!");

// Render markdown
let text = render_markdown("# Hello\n\n**Bold** and *italic* text.", None);

§Examples

See the examples/ directory for runnable demos of each component:

cargo run --example resizable_split_demo
cargo run --example tree_view_demo --features tree
cargo run --example toast_manager_demo --features toast

Re-exports§

pub use button::render_title_with_buttons;
pub use button::Button;
pub use clickable_scrollbar::ClickableScrollbar;
pub use clickable_scrollbar::ClickableScrollbarState;
pub use clickable_scrollbar::ScrollbarEvent;
pub use pane::Pane;
pub use dialog::Dialog;dialog
pub use dialog::DialogType;dialog
pub use dialog::DialogWidget;dialog
pub use toast::render_toasts;toast
pub use toast::Toast;toast
pub use toast::ToastLevel;toast
pub use toast::ToastManager;toast
pub use resizable_split::ResizableSplit;split
pub use resizable_split::SplitDirection;split
pub use tree_view::get_visible_paths;tree
pub use tree_view::NodeState;tree
pub use tree_view::TreeKeyBindings;tree
pub use tree_view::TreeNavigator;tree
pub use tree_view::TreeNode;tree
pub use tree_view::TreeView;tree
pub use tree_view::TreeViewState;tree
pub use menu_bar::MenuBar;menu
pub use menu_bar::MenuItem;menu
pub use statusbar::StatusBar;statusbar
pub use statusbar::StatusItem;statusbar
pub use statusline_stacked::OperationalMode;statusbar
pub use statusline_stacked::StatusLineStacked;statusbar
pub use statusline_stacked::StyledStatusLine;statusbar
pub use statusline_stacked::SLANT_BL_TR;statusbar
pub use statusline_stacked::SLANT_TL_BR;statusbar
pub use hotkey_footer::HotkeyFooter;hotkey
pub use hotkey_footer::HotkeyFooterBuilder;hotkey
pub use hotkey_footer::HotkeyItem;hotkey
pub use hotkey_modal::render_hotkey_modal;hotkey
pub use hotkey_modal::Hotkey;hotkey
pub use hotkey_modal::HotkeyModalConfig;hotkey
pub use hotkey_modal::HotkeySection;hotkey
pub use markdown_renderer::render_markdown;markdown
pub use markdown_renderer::render_markdown_with_style;markdown
pub use markdown_renderer::MarkdownStyle;markdown
pub use alac_term::AlacTerm;terminal
pub use vt100_term::VT100Term;terminal
pub use ai_chat::AiChat;terminal
pub use fuzzy_finder::FuzzyFinder;fuzzy
pub use file_system_tree::FileSystemEntry;file-tree
pub use file_system_tree::FileSystemTree;file-tree
pub use file_system_tree::FileSystemTreeConfig;file-tree
pub use master_layout::EventResult;master-layout
pub use master_layout::InteractionMode;master-layout
pub use master_layout::MasterLayout;master-layout
pub use master_layout::NavigationBar;master-layout
pub use master_layout::PaneContent;master-layout
pub use master_layout::PaneId;master-layout
pub use master_layout::PaneLayout;master-layout
pub use master_layout::Tab;master-layout
pub use master_layout::TabButton;master-layout

Modules§

ai_chatterminal
alac_termterminal
button
clickable_scrollbar
Clickable scrollbar with mouse support adapted from rat-salsa’s rat-scrolled
dialogdialog
file_system_treefile-tree
fuzzy_finderfuzzy
hotkey_footerhotkey
hotkey_modalhotkey
markdown_renderermarkdown
master_layoutmaster-layout
Master Layout Framework
menu_barmenu
pane
prelude
Prelude module for convenient imports
resizable_splitsplit
statusbarstatusbar
statusline_stackedstatusbar
A status-line widget that can stack up indicators on the left and right end.
toasttoast
tree_viewtree
vt100_termterminal
VT100 Terminal implementation inspired by mprocs

Enums§

Error
Error types for the crate

Type Aliases§

Result
Result type for the crate