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:
- Layout Components:
ResizableSplitfor flexible UI layouts - UI Components:
Button,Dialog,Toast,Panefor common UI elements - Widgets:
TreeViewfor data display - Navigation:
MenuBar,HotkeyFooterfor navigation aids - Rendering:
render_markdownfor markdown to ratatui text conversion - Terminal:
TermTuifor embedded terminal emulation - Theming: [
theme] module with 33 builtin themes and JSON loader
§Feature Flags
The crate uses feature flags to minimize dependencies:
| Feature | Default | Description |
|---|---|---|
markdown | Yes | Markdown rendering support |
tree | Yes | Tree view widget |
dialog | Yes | Modal dialog components |
toast | Yes | Toast notification system |
split | Yes | Resizable split panels |
menu | Yes | Menu bar component |
statusline | Yes | Powerline-style statusline |
hotkey | Yes | Hotkey footer and modal |
terminal | No | Terminal emulator (TermTui) |
file-tree | No | File system tree with devicons |
theme | No | Theme system with 33 builtin themes |
full | No | Enable 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 toastRe-exports§
pub use primitives::button::Button;pub use primitives::pane::Pane;pub use widgets::ai_chat::AIChat;pub use widgets::ai_chat::AIChatEvent;pub use widgets::ai_chat::InputState;pub use widgets::ai_chat::Message;pub use widgets::ai_chat::MessageRole;pub use widgets::ai_chat::MessageStore;pub use widgets::code_diff::CodeDiff;pub use widgets::code_diff::DiffConfig;pub use widgets::code_diff::DiffHunk;pub use widgets::code_diff::DiffLine;pub use widgets::code_diff::DiffLineKind;pub use widgets::code_diff::DiffStyle;pub use widgets::split_layout::SplitLayoutWidget;pub use widgets::split_layout::SplitLayoutWidgetState;pub use primitives::dialog::widget::DialogWidget;dialogpub use primitives::dialog::Dialog;dialogpub use primitives::dialog::DialogType;dialogpub use primitives::toast::methods::render_toasts::render_toasts;toastpub use primitives::toast::Toast;toastpub use primitives::toast::ToastLevel;toastpub use primitives::toast::ToastManager;toastpub use primitives::resizable_split::ResizableSplit;splitpub use primitives::resizable_split::SplitDirection;splitpub use primitives::split_layout::PaneId;splitpub use primitives::split_layout::PaneLayout;splitpub use primitives::split_layout::SplitAxis;splitpub use primitives::split_layout::SplitLayout;splitpub use primitives::tree_view::get_visible_paths;treepub use primitives::tree_view::matches_filter;treepub use primitives::tree_view::NodeState;treepub use primitives::tree_view::TreeKeyBindings;treepub use primitives::tree_view::TreeNode;treepub use primitives::tree_view::TreeView;treepub use primitives::tree_view::TreeViewRef;treepub use primitives::tree_view::TreeViewState;treepub use primitives::menu_bar::MenuBar;menupub use primitives::menu_bar::MenuItem;menupub use primitives::statusline::OperationalMode;statuslinepub use primitives::statusline::StatusLineStacked;statuslinepub use primitives::statusline::StyledStatusLine;statuslinepub use primitives::statusline::SLANT_BL_TR;statuslinepub use primitives::statusline::SLANT_TL_BR;statuslinepub use widgets::hotkey_footer::HotkeyItem;hotkeypub use widgets::markdown_widget::render_markdown;hotkeyandmarkdownpub use widgets::markdown_widget::render_markdown_with_style;hotkeyandmarkdownpub use widgets::markdown_widget::CacheState;hotkeyandmarkdownpub use widgets::markdown_widget::CodeBlockTheme;hotkeyandmarkdownpub use widgets::markdown_widget::CollapseState;hotkeyandmarkdownpub use widgets::markdown_widget::DisplaySettings;hotkeyandmarkdownpub use widgets::markdown_widget::DoubleClickState;hotkeyandmarkdownpub use widgets::markdown_widget::ExpandableState;hotkeyandmarkdownpub use widgets::markdown_widget::GitStats;hotkeyandmarkdownpub use widgets::markdown_widget::GitStatsState;hotkeyandmarkdownpub use widgets::markdown_widget::MarkdownDoubleClickEvent;hotkeyandmarkdownpub use widgets::markdown_widget::MarkdownEvent;hotkeyandmarkdownpub use widgets::markdown_widget::MarkdownState;hotkeyandmarkdownpub use widgets::markdown_widget::MarkdownStyle;hotkeyandmarkdownpub use widgets::markdown_widget::MarkdownWidget;hotkeyandmarkdownpub use widgets::markdown_widget::MarkdownWidgetMode;hotkeyandmarkdownpub use widgets::markdown_widget::ScrollState;hotkeyandmarkdownpub use widgets::markdown_widget::SelectionPos;hotkeyandmarkdownpub use widgets::markdown_widget::SelectionState;hotkeyandmarkdownpub use widgets::markdown_widget::SourceState;hotkeyandmarkdownpub use widgets::markdown_widget::VimState;hotkeyandmarkdownpub use primitives::termtui::TermTui;terminalpub use primitives::termtui::TermTuiKeyBindings;terminalpub use widgets::file_system_tree::FileSystemEntry;file-treepub use widgets::file_system_tree::FileSystemTree;file-treepub use widgets::file_system_tree::FileSystemTreeConfig;file-treepub use services::theme::AppTheme;themepub use services::theme::DiffColors;themepub use services::theme::MarkdownColors;themepub use services::theme::SyntaxColors;themepub use services::theme::ThemeVariant;themepub use services::file_watcher::FileWatcher;pub use services::file_watcher::WatchConfig;pub use services::file_watcher::WatchMode;
Modules§
- prelude
- Prelude module for convenient imports
- primitives
- services
- Shared services and utilities for ratatui-toolkit.
- widgets
Enums§
- Error
- Error types for the crate
Type Aliases§
- Result
- Result type for the crate