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
statuslineYesPowerline-style statusline
hotkeyYesHotkey footer and modal
terminalNoTerminal emulator (TermTui)
file-treeNoFile system tree with devicons
themeNoTheme system with 33 builtin themes
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 primitives::button::render_title_with_buttons::render_title_with_buttons;
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;dialog
pub use primitives::dialog::Dialog;dialog
pub use primitives::dialog::DialogType;dialog
pub use primitives::toast::methods::render_toasts::render_toasts;toast
pub use primitives::toast::Toast;toast
pub use primitives::toast::ToastLevel;toast
pub use primitives::toast::ToastManager;toast
pub use primitives::resizable_split::ResizableSplit;split
pub use primitives::resizable_split::SplitDirection;split
pub use primitives::split_layout::PaneId;split
pub use primitives::split_layout::PaneLayout;split
pub use primitives::split_layout::SplitAxis;split
pub use primitives::split_layout::SplitLayout;split
pub use primitives::tree_view::get_visible_paths;tree
pub use primitives::tree_view::matches_filter;tree
pub use primitives::tree_view::NodeState;tree
pub use primitives::tree_view::TreeKeyBindings;tree
pub use primitives::tree_view::TreeNavigator;tree
pub use primitives::tree_view::TreeNode;tree
pub use primitives::tree_view::TreeView;tree
pub use primitives::tree_view::TreeViewRef;tree
pub use primitives::tree_view::TreeViewState;tree
pub use primitives::menu_bar::MenuBar;menu
pub use primitives::menu_bar::MenuItem;menu
pub use primitives::statusline::OperationalMode;statusline
pub use primitives::statusline::StatusLineStacked;statusline
pub use primitives::statusline::StyledStatusLine;statusline
pub use primitives::statusline::SLANT_BL_TR;statusline
pub use primitives::statusline::SLANT_TL_BR;statusline
pub use widgets::hotkey_footer::HotkeyFooter;hotkey
pub use widgets::hotkey_footer::HotkeyFooterBuilder;hotkey
pub use widgets::hotkey_footer::HotkeyItem;hotkey
pub use widgets::markdown_widget::render_markdown;hotkey and markdown
pub use widgets::markdown_widget::render_markdown_with_style;hotkey and markdown
pub use widgets::markdown_widget::CacheState;hotkey and markdown
pub use widgets::markdown_widget::CodeBlockTheme;hotkey and markdown
pub use widgets::markdown_widget::CollapseState;hotkey and markdown
pub use widgets::markdown_widget::DisplaySettings;hotkey and markdown
pub use widgets::markdown_widget::DoubleClickState;hotkey and markdown
pub use widgets::markdown_widget::ExpandableState;hotkey and markdown
pub use widgets::markdown_widget::GitStats;hotkey and markdown
pub use widgets::markdown_widget::GitStatsState;hotkey and markdown
pub use widgets::markdown_widget::MarkdownDoubleClickEvent;hotkey and markdown
pub use widgets::markdown_widget::MarkdownEvent;hotkey and markdown
pub use widgets::markdown_widget::MarkdownState;hotkey and markdown
pub use widgets::markdown_widget::MarkdownStyle;hotkey and markdown
pub use widgets::markdown_widget::MarkdownWidget;hotkey and markdown
pub use widgets::markdown_widget::MarkdownWidgetMode;hotkey and markdown
pub use widgets::markdown_widget::ScrollState;hotkey and markdown
pub use widgets::markdown_widget::SelectionPos;hotkey and markdown
pub use widgets::markdown_widget::SelectionState;hotkey and markdown
pub use widgets::markdown_widget::SourceState;hotkey and markdown
pub use widgets::markdown_widget::VimState;hotkey and markdown
pub use primitives::termtui::TermTui;terminal
pub use primitives::termtui::TermTuiKeyBindings;terminal
pub use widgets::file_system_tree::FileSystemEntry;file-tree
pub use widgets::file_system_tree::FileSystemTree;file-tree
pub use widgets::file_system_tree::FileSystemTreeConfig;file-tree
pub use services::theme::AppTheme;theme
pub use services::theme::DiffColors;theme
pub use services::theme::MarkdownColors;theme
pub use services::theme::SyntaxColors;theme
pub use services::theme::ThemeVariant;theme
pub 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