dioxus-ratatui/README.md
Tyler King da7b4c5658 feat: dioxus-ratatui v0.1.0 — Ratatui renderer for Dioxus
Bridge between Dioxus Core (reactive components) and
Ratatui (terminal rendering).

Architecture: retained TuiNode tree + immediate Ratatui render
  Dioxus VirtualDom → WriteMutations → TuiTree → Frame → Terminal

Modules:
  tree.rs      — retained node tree (Element, Text, Placeholder)
  renderer.rs  — WriteMutations impl (14 methods)
  layout.rs    — Dioxus attrs → Ratatui Constraint/Direction
  style.rs     — attrs → Ratatui Style (colors, bold, italic)
  events.rs    — crossterm quit detection
  render.rs    — tree walker → Ratatui widget rendering
  lib.rs       — launch() + event loop + terminal lifecycle

Elements: div, p, span, h1-h3, hr
Layout: vertical/horizontal split, percentage/length/fill constraints
Styling: named colors, hex, bold, italic, underline, dim
Events: keyboard quit (Ctrl+C, q)

453 lines. Zero governance/substrate dependencies.
Apache 2.0 — pure community crate.

Signed-off-by: Tyler King <tking@guildhouse.dev>
2026-04-05 14:38:14 -04:00

1.1 KiB

dioxus-ratatui

Ratatui renderer for Dioxus — build reactive terminal UIs with Dioxus components.

Early development — API will change.

Quick Start

use dioxus::prelude::*;

fn main() {
    dioxus_ratatui::launch(App);
}

fn App() -> Element {
    rsx! {
        div {
            h1 { "Hello from Dioxus + Ratatui!" }
            p { "Press 'q' or Ctrl+C to quit." }
        }
    }
}

Architecture

Dioxus VirtualDom sends mutations via WriteMutations trait. The bridge maintains a retained tree of TuiNode structs. Each frame, Ratatui walks the tree and renders widgets.

Dioxus VirtualDom → WriteMutations → TuiTree → Ratatui Frame → Terminal

Supported Elements

Element Widget Status
div Block container v0.1
p, span Paragraph v0.1
h1-h3 Bold paragraph v0.1
hr Horizontal line v0.1

Layout

Children of div elements are stacked vertically by default. Ratatui constraints are derived from element attributes via the layout module.

License

Apache 2.0