Playground
Runnable examples live in
playground/ - one
directory per feature, numbered in learning order, from the quick start to a
capstone form that composes everything:
| Directory | Demonstrates |
|---|---|
01-quickstart | The 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-editing | Inline editing and ->standalone() |
05-headless | Unattended collection, the JSON schema, validation, agent help |
06-form-logic | Derived values, conditional fields, fix-ups |
07-field-behaviour | Declared behaviour: closures and handler classes |
08-discovery | Discovery against a bundled sample project |
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 colour |
12-testing | The test harness driving the TUI from scripted keystrokes |
13-translations | Translations through a consumer catalog |
14-produce-box | The capstone: panels, widgets, logic and behaviour in one real form |
Every script is self-contained - it requires the Composer autoloader directly
and declares its whole form inline, so any single file can be copied out as a
starting point. No script takes 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.
composer install
php playground/01-quickstart/run.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 (requires 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.