tui table for viewers
Command Type
built-in
Signature
> tui table {flags} (source)
Flags
--columns {list<string>}: Columns to show. Defaults to the columns of the input table.--capture-keys: A chord pressed on the focused table becomes the filter query.--index, -i: Select row indexes instead of rows.--id {string}: Widget id.--focus: Start with this widget focused.--data {any}: Data for this widget alone, instead of the outer pipeline's.--from {string}: Id of the table, tree, or select whose highlighted row drives this widget.--on-select {closure(any)}: Hook run when the highlighted row changes; receives the state record.--multi, -m: Space toggles rows; the selection is the checked rows.
Parameters
source: Closure over the --from row whose output is this table's rows.
Input/output types:
| input | output |
|---|---|
| nothing | tui |
| tui | tui |
| any | tui |
Examples
Show a small table and pick a row
> [{name: foo, size: 1}, {name: bar, size: 2}] | tui table --columns [name size] | tui debug --keys down,enter | get selected.nameCheck several rows and submit them
> [a b c] | tui table --multi | tui debug --keys [space down space enter] | get selectedA detail table driven by a tree
> ls | tui split [(tui tree --walk) (tui table --from tree-0 {|node| ls $node.name })] | tui runKeybinding explorer: press a chord to filter
> $env.config.keybindings | tui table --capture-keys --columns [name modifier keycode] | tui runNotes
Up/Down, j/k, PageUp/PageDown, Home/End, and mouse wheel move the selection. Enter submits the current row (--index submits its index). With --multi, Space checks rows and the selection is the checked rows. A tui search widget filters rows as you type. Streams append while the TUI runs (oldest rows drop after 10,000).
--data gives this table its own rows; --from <id> with a closure makes it a detail view of another widget's highlighted row: tui table --from tree-0 {|node| ls $node.name }. --on-select runs a hook whenever the highlight moves.
--capture-keys turns a chord pressed on the focused table (for example Ctrl+R) into the filter query, so a keybinding table filters to bindings that match that chord. Rows with modifier/keycode fields match reedline-style chords.