ratatui-tui

Build terminal user interfaces in Rust with ratatui templates and patterns.

Updated Dec 7, 2025
One-click install
npx skills add https://github.com/harlanljones/dotfiles --skill ratatui-tui-harlanljones
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ratatui-tui
Source: https://github.com/harlanljones/dotfiles/tree/main/dot_hermes/skills/ratatui-tui
Command: npx skills add https://github.com/harlanljones/dotfiles --skill ratatui-tui-harlanljones

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve? Building terminal UIs in Rust involves many decisions: project structure, event loops, async handling, styling, image rendering, and release optimization. This Skill provides ready-to-use templates, vetted patterns, and review workflows so you avoid common pitfalls like unhandled panics leaving the terminal in raw mode or blocking event loops that prevent background tasks. ## Core Features & Use Cases - Project Templates: Four copy-ready Cargo templates (hello-world, simple-app, async-app, component-app) covering minimal demos through full modular apps with config, logging, and CLI parsing. - Architecture Guidance: The Elm Architecture (TEA) pattern, StatefulWidget usage, Component traits, Action channels, and mode-based state machines for keyboard-driven apps. - Async & Media: Tokio EventStream patterns with select!, background task channels, debouncing, ratatui-image integration (Sixel/Kitty/iTerm2), and tui-shimmer loading animations. - Code Review Workflow: A multi-agent review template that checks TEA compliance, terminal safety, styling, event handling, and render performance with adversarial verification of findings. - Use Case: You need a terminal dashboard with async data fetching and image previews. Copy the async-app template, add ratatui-image with the background-thread loading pattern, and run the TUI review workflow before release. ## Quick Start Ask the AI to scaffold a new ratatui TUI app using the async-app template and explain how to add keyboard navigation to it.

Frequently Asked Questions about ratatui-tui

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a terminal UI in Rust with ratatui?▼

Start with a template matching your complexity: hello-world for learning, simple-app for single-screen tools, async-app for background tasks, or component-app for multi-view applications. Add ratatui 0.30 and crossterm 0.29 to Cargo.toml, then structure your app around the Model-Message-Update-View loop.

How to handle async events in a ratatui application?▼

Enable crossterm's event-stream feature and use EventStream with tokio::select! to multiplex keyboard input, tick timers, and background task channels. Never call blocking event::read() inside an async loop, and communicate results back through mpsc channels.

Does ratatui support displaying images in the terminal?▼

Yes, via the ratatui-image crate supporting Sixel, Kitty, iTerm2, and halfblock protocols. Query the terminal protocol once at startup with Picker::from_query_stdio(), encode images on a background thread, and render with StatefulImage to avoid re-encoding per frame.

ratatui vs cursive vs tui-rs which should I use?▼

ratatui is the actively maintained fork of the archived tui-rs and the current standard for Rust TUIs, with version 0.30.1 on edition 2024. It offers immediate-mode rendering, a modular workspace with ratatui-core for widget libraries, and ecosystem crates like ratatui-image and tui-shimmer.

Why does my terminal stay broken after my ratatui app panics?▼

The terminal stays in raw mode when a panic occurs without a restoration hook. Use ratatui::run() or ratatui::init()/restore(), which install a panic hook that restores the terminal, and install color-eyre before terminal initialization.

How do I optimize ratatui release binary size?▼

Configure the release profile with lto = true, codegen-units = 1, panic = "abort", strip = true, and opt-level = "z" when size matters more than speed. Keep the layout-cache feature enabled, since disabling default-features removes it and sharply reduces layout performance.