Skip to main content

Playground

Runnable examples live in playground/ - one file per example, grouped by a numbered prefix that follows this documentation's order, from the quick start to the capstone form:

GroupDemonstrates
01-quickstartThe fluent builder and run() - the form from the quick start
02-widgets-*One script per widget, plus the whole gallery on one form
03-panels-*Nested panels, modal dialogs and the border frame
04-inline-editingInline editing and ->standalone()
05-form-logic-*Derived values, conditional fields, fix-ups
06-field-behaviour-*Declared behavior: closures and handler classes
07-discoveryDiscovery against a bundled sample project
08-headless-*Unattended collection, the JSON schema, validation, agent help
09-themes-*The built-in themes, a custom theme class, theme options, field styles
10-key-bindings-*Key bindings: the vim preset and per-binding overrides
11-display-modes-*Display modes: dark/light, ASCII, no color
12-translationsTranslations through a consumer catalog
13-testingThe test harness driving the TUI from scripted keystrokes
14-produce-boxThe capstone: panels, widgets, logic and behavior in one real form

Every script is self-contained: it requires the Composer autoloader directly and declares its whole form inline, so you can copy any single file out as a starting point. Most take no CLI options - each demonstrates exactly one thing, variants are separate scripts, and unattended runs are driven by piping stdin and setting TUI_<ID> environment variables. The exception is 03-panels-fullscreen.php, which takes --halign/--valign and --max-width to pick one alignment from its grid.

composer install
php playground/01-quickstart.php

The SVG demos throughout this documentation are generated from the playground scripts and forms: php docs/util/update-assets.php records the panel walkthroughs through a scripted terminal session (it needs asciinema, expect, node and npm), while php docs/util/render-widget-svgs.php and php docs/util/render-theme-svgs.php render the widget cards and theme previews deterministically through the library's own test harness - no terminal involved.