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.

RatatuiFocusManager

Scene-wide focus arbitration for multiple RatatuiRenderer instances. Only the focused renderer receives keyboard input. Mouse hover/click is unaffected: raycast and rect hit-testing already route mouse events to the correct renderer. Focus changes on mouse-down inside a renderer (click-to-focus).

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.

RatatuiTerminalApp

Base class for terminal apps that can be opened and closed from any scene. Provides shared toggle-key handling, touch toggle, and open/close lifecycle.

RatatuiTerminalAppAttribute

Marker attribute that identifies a class as a terminal app. This attribute does NOT trigger automatic discovery — each app must explicitly call Register<T>(string, string, int) from a [RuntimeInitializeOnLoadMethod(AfterAssembliesLoaded)] static method.

RatatuiTerminalApps

Static bootstrap and registry for terminal apps. Each app registers itself via Register<T>(string, string, int) in a [RuntimeInitializeOnLoadMethod(AfterAssembliesLoaded)] static method, then this manager instantiates them all at BeforeSceneLoad.

StyledText

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

TerminalAppHandle

Registry entry describing one registered terminal app and its live instance.

TerminalCommandInput

A reusable command-line input built on top of TerminalInput. Adds the keystrokes a console/REPL needs (Enter/Escape/Tab/Up/Down) as events, while delegating editing (typing, selection, clipboard, undo/redo, horizontal scroll, mobile IME) to the underlying widget.

Composition rather than inheritance: TerminalInput methods are not virtual, but its public API is rich enough that a wrapper can drive it.

TerminalInput

Single-line text input with selection, clipboard, undo/redo, unicode + CJK width-aware cursor, placeholder, password mask, max length, character filter, cursor blink, click-and-drag selection, double/triple-click, and optional select-all on focus. Pure C# state; renders via StyledParagraph.

TerminalTextArea

Multi-line text editor: line-aware cursor, vertical + horizontal scrollbars (auto-hide), mouse-wheel scrolling, selection spanning lines, clipboard (preserves newlines), undo/redo, click-and-drag selection, double-click word + triple-click all, focus-time select-all, ReadOnly, optional MaxLength + CharFilter.

TextUtils

Codepoint iteration and terminal display-width helpers for text input widgets. All indices are .NET UTF-16 char positions; widths are terminal cell counts.

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.

SizingMode

How RatatuiRenderer interprets the fontSize inspector value. Cols × rows are always preserved; only the per-cell pixel scale changes. Modeled after CSS viewport-relative length units.