Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Shells
    • Strings
    • System
    • Viewers

tui for viewers

Build interactive terminal UIs by composing `tui` subcommands.

Command Type

built-in

Signature

> tui {flags}

Input/output types:

inputoutput
nothingstring

Examples

List TUI subcommands

> tui

Notes

You must use one of the following subcommands. Using this command as-is will only produce this help message.

Builders (tui table, tui split, ...) append widgets to a tui value. tui run shows it and returns one record: {action, focused, selected, page, values, rows, live}, where values holds every widget's state by id. tui debug returns the same record plus the painted screen and the resolved layout, for scripts and tests.

Data: a value piped into a builder is the shared data list. Builders never read a stream: a list stream, a range, or an external command's output is kept in the tui value and read while the TUI runs, so its rows appear as they are produced (1.. | each {|n| sleep 1sec; $n} | tui log). A stream keeps its newest 100k rows (older rows are dropped in batches, so up to 12.5k more may show). When the TUI closes, a stream still producing is stopped: an external command piped straight into a builder at once, and one behind other commands (^tail -f app.log | lines | tui log) at once in an interactive shell, elsewhere the next time it writes. Nushell code in a stream (an each closure) finishes the row it is on, and what it prints while the TUI runs lands on the TUI's screen. A tui value saved with let reads its stream the first time it runs; if that run read it to the end, later runs show the same rows. A widget can have its own rows with --data, or by piping into it inside a container's child list: tui split [(ls | tui table) (ps | tui table)]. A widget can also follow the highlighted row of a table, tree, or select. A closure on tui table, tree, log, progress, or label turns that row into what the widget shows, and --from <id> picks which one to follow; without it the widget follows the focused one, else the nearest, else one on another tab page, but never one that follows it back. --from without a closure shows the row itself. A widget with nothing to follow is an error when the TUI starts, and --data cannot be combined with --from or a closure.

Hooks: tui bind, menu actions, tui button, --on-select, and the tui run refresh closure all receive the state record and may return nothing, a new data list, or {action: submit|quit, selected: ...}. A new data list replaces the shared data for the rest of the run: a piped stream no longer adds to it.

Layout: tui split --sizes [30% 1fr] arranges children; tui box groups them with a border; tui tab makes a page. Bordered widgets take --title to rename their border (tui table --title files shows files (12)); tui label --titlebar fills the bar at the top. Colors come from $env.config.tui; --border on a widget or $env.config.tui.border_type picks its border lines by table --theme name (rounded, double, heavy, ...).

Subcommands:

namedescriptiontype
tui bindRun a hook when a key is pressed anywhere in the TUI.built-in
tui boxGroup widgets inside a titled, bordered box.built-in
tui buttonAdd a button that runs a hook, or submits its label, when activated.built-in
tui debugRender a TUI without a terminal and return the screen plus the resolved layout, focus order, and pages.built-in
tui labelAdd static text: inline, or as the title bar (--titlebar) or status bar (--status).built-in
tui logAdd an append-only log view. Streamed rows appear at the bottom.built-in
tui menuAdd a menu bar with mnemonics, dropdown items, and actions.built-in
tui previewShow text for the selected table, tree, or select row. Arrow keys stay on the source.built-in
tui progressAdd a progress bar.built-in
tui runRun a composed TUI until the user quits or submits a selection.built-in
tui searchAdd a search box that filters tables, logs, trees, and selects as you type.built-in
tui selectAdd a radio list of items, or a checkbox list with --multi.built-in
tui splitLay out child widgets side by side (or stacked with --vertical) with draggable dividers.built-in
tui tabGroup widgets as a page in the tab bar.built-in
tui tableAdd a navigable table. Pipeline rows become the rows; scalars show as one item column.built-in
tui textboxAdd an editable text field. Tab to focus it, then type.built-in
tui treeAdd a tree for nested records or a directory walk.built-in