| Crates.io | tabitha |
| lib.rs | tabitha |
| version | 0.0.2 |
| created_at | 2026-01-14 19:40:26.72878+00 |
| updated_at | 2026-01-18 07:58:46.978325+00 |
| description | An async, event-driven TUI framework with component-based architecture, focus management, and theme support |
| homepage | |
| repository | https://github.com/zbraniecki/tabitha |
| max_upload_size | |
| id | 2043576 |
| size | 353,243 |
An async, event-driven TUI framework built on ratatui and tokio.
Tabitha provides a clean, power-efficient architecture for building terminal user interfaces. It's designed around an event-driven model that only redraws when necessary, making it ideal for applications that need to minimize CPU usage.
Tabitha follows a component-based architecture where you build your UI by implementing the Component trait. The framework handles event routing, focus management, and drawing coordination automatically. Events flow through your components, which can handle them or pass them along. Background tasks can communicate with the UI via typed message channels.
The framework manages three main concerns:
Component - handle events and draw with ratatuiuse tabitha::{AppBuilder, Component, MainUi, Event, AppContext, DrawContext, EventResult};
use ratatui::{Frame, layout::Rect, widgets::Paragraph};
struct MyApp;
impl Component for MyApp {
fn draw(&self, frame: &mut Frame, area: Rect, ctx: &DrawContext) {
frame.render_widget(Paragraph::new("Hello, tabitha!"), area);
}
fn handle_event(&mut self, event: &Event, ctx: &mut AppContext) -> EventResult {
if event.is_quit() {
ctx.quit();
return EventResult::Handled;
}
EventResult::Unhandled
}
}
impl MainUi for MyApp {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let app = AppBuilder::new()
.main_ui(MyApp)
.build()?;
app.run().await?;
Ok(())
}
Components are the building blocks of your TUI. They implement draw() to render UI and handle_event() to process input. Components can declare themselves focusable to participate in keyboard navigation.
Two context types provide access to framework functionality:
DrawContext: Available during rendering - access theme, tabs, focus stateAppContext: Available during event handling - control app lifecycle, tabs, focus, modalsTabs provide multi-page navigation. Register tabs at build time, then use ctx.tabs() to draw the tab bar and switch between tabs at runtime.
The framework includes a theme system with semantic color roles. Themes can be customized and swapped. When modals are displayed, the background automatically uses a dimmed (grayscale) version of the theme.
[dependencies]
tabitha = "0.0.1"
ratatui = "0.30"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
cargo run --example counter # Counter with background task
cargo run --example tabs # Tab navigation
cargo run --example modal # Modal dialogs
cargo run --example textbox # Text input widgets
cargo run --example datatable # Interactive data tables
Licensed under either of:
at your option.