tui-world

Crates.iotui-world
lib.rstui-world
version0.1.0
created_at2026-01-17 20:22:48.529792+00
updated_at2026-01-17 20:22:48.529792+00
descriptionA state and event management library for TUIs built with ratatui
homepage
repositoryhttps://github.com/preiter93/tui-world
max_upload_size
id2051080
size79,791
Philipp Reiter (preiter93)

documentation

README

tui-world

⚠️ Work in Progress: This library is development.

A state and event management library for TUIs built with ratatui.

Core Concepts

  • World - A container that holds application state
  • Keybindings - Key binding registry with built-in help display
  • Focus - Tracks which widget is active
  • Layout - Tracks widget areas for mouse hit testing
  • Mouse - Mouse click handling per widget

Example

use tui_world::prelude::*;

// Store state in world
world.insert(MyAppState::default());

// Register keybindings
let kb = world.get_mut::<Keybindings>();
kb.bind(
    Context::Widget(MY_WIDGET_ID),
    KeyBinding::key(KeyCode::Enter),
    "Select",
    "Select the current item",
    |world| {
        world.get_mut::<MyAppState>().select();
    },
);

// Handle events
Event::Key(key).handle(&mut world);
Event::Mouse(mouse).handle(&mut world);

See examples/todo for a complete example.

License

MIT

Commit count: 4

cargo fmt