Expand description
§SLT — Super Light TUI
Immediate-mode terminal UI for Rust. Two dependencies. Zero unsafe.
SLT gives you an egui-style API for terminals: your closure runs each frame, you describe your UI, and SLT handles layout, diffing, and rendering.
§Quick Start
fn main() -> std::io::Result<()> {
slt::run(|ui| {
ui.text("hello, world");
})
}§Features
- Flexbox layout —
row(),col(),gap(),grow() - 14 built-in widgets — input, textarea, table, list, tabs, button, checkbox, toggle, spinner, progress, toast, separator, help bar, scrollable
- Styling — bold, italic, dim, underline, 256 colors, RGB
- Mouse — click, hover, drag-to-scroll
- Focus — automatic Tab/Shift+Tab cycling
- Theming — dark/light presets or custom
- Animation — tween and spring primitives with 9 easing functions
- Inline mode — render below your prompt, no alternate screen
- Async — optional tokio integration via
asyncfeature - Layout debugger — F12 to visualize container bounds
§Feature Flags
| Flag | Description |
|---|---|
async | Enable run_async() with tokio channel-based message passing |
Re-exports§
pub use anim::Spring;pub use anim::Tween;pub use context::Context;pub use context::Response;pub use event::KeyCode;pub use event::KeyModifiers;pub use event::MouseButton;pub use event::MouseEvent;pub use event::MouseKind;pub use style::Align;pub use style::Border;pub use style::Color;pub use style::Constraints;pub use style::Margin;pub use style::Modifiers;pub use style::Padding;pub use style::Style;pub use style::Theme;pub use widgets::ListState;pub use widgets::ScrollState;pub use widgets::SpinnerState;pub use widgets::TableState;pub use widgets::TabsState;pub use widgets::TextInputState;pub use widgets::TextareaState;pub use widgets::ToastLevel;pub use widgets::ToastMessage;pub use widgets::ToastState;
Modules§
Structs§
- RunConfig
- Configuration for a TUI run loop.
Functions§
- run
- Run the TUI loop with default configuration.
- run_
inline - Run the TUI in inline mode with default configuration.
- run_
inline_ with - Run the TUI in inline mode with custom configuration.
- run_
with - Run the TUI loop with custom configuration.