TL;DR — Quick Summary

Ratatui is a Rust library for building rich terminal UIs. Widgets, layouts, charts, event handling — the framework behind lazygit, bottom, gitui, and hundreds of TUI apps.

Ratatui powers the best TUI apps. The framework behind lazygit, bottom, gitui — build beautiful terminal interfaces.

Installation

# Cargo.toml
[dependencies]
ratatui = "0.28"
crossterm = "0.28"

Quick Start

use ratatui::prelude::*;
use ratatui::widgets::*;

fn ui(frame: &mut Frame) {
    let layout = Layout::default()
        .direction(Direction::Vertical)
        .constraints([
            Constraint::Length(3),
            Constraint::Min(0),
        ])
        .split(frame.area());

    let title = Paragraph::new("My TUI App")
        .block(Block::default().borders(Borders::ALL));
    frame.render_widget(title, layout[0]);

    let items = vec!["Item 1", "Item 2", "Item 3"];
    let list = List::new(items)
        .block(Block::default().title("List").borders(Borders::ALL));
    frame.render_widget(list, layout[1]);
}

Widgets

  • Paragraph: Text blocks with wrapping and scrolling
  • List: Selectable lists with highlighting
  • Table: Aligned columns with headers
  • Chart: Bar charts, line charts, sparklines
  • Gauge: Progress bars
  • Tabs: Tab navigation
  • Canvas: Custom drawing

Summary

  • Ratatui is the leading Rust TUI framework
  • Used by lazygit, bottom, gitui, and 1000+ apps
  • Rich widgets: tables, charts, lists, gauges, canvas
  • Responsive layouts with constraint-based system
  • crossterm and termion backend support