Table of Contents

Namespace RatatuiUnity

Classes

CanvasBuilder

Fluent builder for canvas widgets: world map, geometric shapes, text, and point clouds.

ChartBuilder

Fluent builder for line/scatter charts with multiple datasets and labeled axes.

RatatuiRenderer

MonoBehaviour that renders a Ratatui terminal to a UnityEngine.Texture2D and optionally assigns it to a UI UnityEngine.UI.RawImage or a MeshRenderer material each frame. When no target is assigned, falls back to OnGUI rendering. Use Full to stretch the terminal to the entire screen, Partial to draw at native pixel size with configurable alignment, or Window for a draggable macOS-style window whose title bar shows gameObject.name.

Override BuildFrame(RatatuiTerminal) to define widget layout. Override OnTerminalKeyDown(TerminalKeyEvent), OnTerminalMouseEvent(TerminalMouseEvent), and OnTerminalHoverChanged(TerminalHoverState, TerminalHoverState) to handle input events.

RatatuiTerminal

High-level C# API for the ratatui native library. Wraps lifecycle, layout, style, and widget commands. Must be disposed when no longer needed.

StyledText

Fluent builder for styled paragraphs with per-span colors and text modifiers.

TerminalInput

Single-line text input field with cursor navigation, editing, and horizontal scrolling. Pure C# state — renders via StyledParagraph.

Structs

Constraint

Layout constraint for Split(uint, Direction, params Constraint[]). Matches the constraint type byte values expected by the Rust C API.

TerminalHoverState

Tracks the current mouse hover position in terminal coordinates. Updated every frame by RatatuiRenderer when mouse input is enabled.

TerminalKeyEvent

A keyboard event in the terminal context. Carries both the Unity KeyCode and the typed character (if any).

TerminalMouseEvent

A mouse event in terminal cell coordinates.

Interfaces

ITab

Contract for a self-contained demo tab. The host RatatuiRenderer calls Update(float) every frame, then Render(RatatuiTerminal, uint) inside BuildFrame, and forwards user input via OnKeyEvent(TerminalKeyEvent), OnMouseEvent(TerminalMouseEvent), and OnHoverChanged(TerminalHoverState, TerminalHoverState).

Enums

Alignment

Text alignment, matching the Rust C API byte values.

Borders

Bitmask for block border sides, matching the Rust C API byte values.

Constraint.ConstraintType
Direction

Layout split direction, matching the Rust C API byte values.

KeyModifiers

Modifier keys bitmask.

MapResolution

Resolution of the world map drawn on a canvas.

Marker

Marker style used for chart datasets and canvas drawing.

Modifier

Text style modifiers; can be combined with the | operator.

MouseButton
MouseEventType
OnGuiHorizontalAlign

Horizontal placement of the OnGUI rect in Partial mode.

OnGuiMode

OnGUI fallback display mode when no RawImage or MeshRenderer target is assigned.

OnGuiVerticalAlign

Vertical placement of the OnGUI rect in Partial mode.

ScrollbarOrientation

Orientation and placement of a scrollbar widget.