Every directory under examples/ is a runnable program. Clone the repository and run one from its root, for example go run ./examples/dashboard.
The screens are not mock-ups: each is the first frame the example’s own size-matrix test renders at 80×24, shown with the colours its View produces. Only the 16 basic terminal colours depend on a palette, as in any terminal.
chat is a manual showcase of the InkUI-parity widgets added after the original dashboard/form/list examples: Gauge, CodeBlock, DiffView, markdown.Render, streamtext (Typewriter), TokenCounter and layout.Column and layout.Row.
welcomescreen is the canonical reference for a static informational splash composed entirely from the existing widget catalog — widgets.Panel, widgets.BigText, widgets.Header and widgets.KeyValue side by side in a layout.Row.
go run ./examples/welcomescreen
╭──────────────────────────────────────────────────────────╮│││Welcome to TUI││││┌──────────────────────┐┌────────────────────────────┐│││││││││██████████││Info ││││████││──────────────────────────││││████││Version: v1.0.0 ││││████││User: Ada Lovelace ││││██████││Workspace: acline │││││││││└──────────────────────┘└────────────────────────────┘││││enter/esc continue ctrl+c quit│││╰──────────────────────────────────────────────────────────╯
splashscreen follows the same composition-only shape as examples/welcomescreen and examples/loginflow: widgets.BigText for the logo and widgets.Header for a tagline, dismissed by any keypress.
go run ./examples/splashscreen
████████████████████████████Loading your workspace…press any key to continue
probe shows what your terminal supports, using the library's opt-in capability options: colour depth (with NO_COLOR, COLORTERM and TERM honoured), focus in/out reporting, and OSC 11 background detection.
go run ./examples/probe
tui probe: what does your terminal do? TERM="xterm-256color" COLORTERM="truecolor" NO_COLOR="" Colour profile: truecolor (detected; drives the strip below) Focus reports: in=0 out=0 last=unknown (click another window, then back) Background: waiting theme=- (asked once at start, 700ms timeout) Last key: - Size (resize): 80x24q or ctrl+c to quit; a summary line stays in your scrollback probe: profile=truecolor focus_in=0 focus_out=0 background=waiting theme=-focus timeline: focus reporting enabled: (not yet)
loginflow is the canonical reference for a login-shaped screen composed entirely from the existing widget catalog — widgets.BigText for the title, widgets.Banner for an announcement, and picker.Model configured as a numbered-select account menu.
go run ./examples/loginflow
████████████████████████████████████████████████████ℹ Pick an account to continue — no password requir> Continue as Ada Lovelace Continue as guest Quitenter select ctrl+c quit
setupflow follows the same composition-only shape as examples/welcomescreen and examples/loginflow: widgets.BigText for the title, widgets.Alert for a status message, and picker.Model as a numbered-select menu of setup steps.
login is a credential sign-in screen built on package form, with a live design-system panel beside it for trying every theming control the library has.
go run ./examples/login
┌──────────────────────────────────────────────┐│││Sign in││││demo: ada / lovelace││││ Username: ada││ Password: ││[ ] Remember me ││││[tab] next[enter] sign in[ctrl+t] design│││└──────────────────────────────────────────────┘
signup is a small account form built on package form: text, secret, select and checkbox fields with validation, Tab and Shift+Tab to move between them, the arrow keys and Space to change a choice, Enter to submit (Esc quits).
╭──────────────────────────────────────────────╮│││Sign up││││● Edit→○ Confirm││││ Name: Ada Lovelace││ Email: ada@example.com││ Language: start typing...││││tab next field enter next/confirm esc quit│││╰──────────────────────────────────────────────╯
focus is the canonical, minimal reference for coordinating Focus()/Blur() across mixed widget types in this repo.
go run ./examples/focus
╭───────────────────────────────────────────╮│││Focus/Blur reference││││╭───────────────────────────────────────╮│││Name: Ada Lovelace│││╰───────────────────────────────────────╯││╭───────────────────────────────────────╮│││Password: │││╰───────────────────────────────────────╯││╭───────────────────────────────────────╮│││a few words about you...│││╰───────────────────────────────────────╯││││tab next shift+tab prev esc/ctrl+c quit│││╰───────────────────────────────────────────╯
cursorfield shows a text input whose cursor is the terminal's real cursor: the model implements tui.CursorPlacer by forwarding textinput.Model.CursorCell, so an IME or a screen magnifier can follow the field.
table is a dedicated, standalone example for datatable.Model's interactive row selection: Up/Down move the cursor and Enter confirms the row under it via SelectedMsg.
go run ./examples/table
Name Role────────────────────────────────> Ada Lovelace Engineer Grace Hopper Rear Admiral Margaret Hamilton Director Katherine Johnson MathematicianSelected: (none yet — press Enter)[↑/↓] move[enter] select[q] quit
router is the canonical reference for switching between independent top-level screens in this repo, the way examples/focus is the canonical reference for Focus/Blur coordination.
╭──────────────────────────────────────────────────────────────╮│││Pager││││ Paragraph 1 ││ This from-scratch TUI framework talks to the terminal ││ directly via raw syscall ioctls, no golang.org/x/term and no ││ Bubble Tea. ││││ Paragraph 2 ││ The event loop follows the Elm Architecture: a Model ││ implements Init, Update, and View, and Program owns the ││ terminal, the input parsing, and a line-level diffing ││ renderer. │││╰──────────────────────────────────────────────────────────────╯up/down/pgup/pgdown/home/end/wheel scroll gg top G bottom q quit 0%
asyncload demonstrates the async-Cmd-resolves-into-a-Msg pattern: a tui.Cmd is just a func() tui.Msg, and Program.dispatch (see program.go) runs each Cmd on its own goroutine and feeds whatever Msg it returns back into the event loop.
procstream demonstrates streaming a child process's stdout into a scrolling widget (logview.Model) line by line, as it arrives, rather than buffering the whole thing and rendering it once the process exits.
go run ./examples/procstream
procstream — streaming a child process's stdoutstatus: running...(q/esc to quit)
buildlog demonstrates tui.Println (see cmds.go): a Cmd that commits text permanently to the terminal's real scrollback, above the live-updating region, rather than being part of an ordinary View() repaint.