PromptPlus

PromptPlus # PromptPlus ## **TableSelect<T> — Operations** [![NuGet](https://img.shields.io/badge/NuGet-PromptPlus-blue)](https://www.nuget.org/packages/PromptPlus) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![.NET](https://img.shields.io/badge/.NET-8%20%7C%209%20%7C%2010-512BD4)](https://dotnet.microsoft.com/)

← Back to HomeNext: TableSelect — Styles →


How the TableSelect<T> control behaves while it is running: keyboard, columns, filtering, horizontal scrolling, paging, validation, history, and view-only mode.


Anatomy of the control

Select a product                         ← prompt
Category: Electronics                     ← description (optional / dynamic)
┌──────┬───────────────┬────────────┐
│  Id  │ Name          │   Price    │    ← header row
├──────┼───────────────┼────────────┤
│    1 │ Notebook Pro  │  $ 1299.99 │    ← focused row (SelectedCell)
│    2 │ Wireless Mouse│  $   29.90 │
└──────┴───────────────┴────────────┘
Filter: note                              ← live filter text (when filtering)
Page 1/2                                  ← pagination
Enter: confirm  Esc: cancel               ← tooltip

Every region can be recolored — see Styles.


Keyboard

Key Action
/ Move focus up / down (rows)
Page Up / Page Down Jump one page
Ctrl+Home / Ctrl+End First / last row
Tab / Shift+Tab Move the focused column; wraps around at the first/last column
Enter Confirm the focused row (runs validation)
Esc Abort → IsAborted == true
Any printable character Type to filter (when Filter is not Disabled)
Backspace Edit the filter text
F1 Cycle tooltip content
Ctrl+F1 Show / hide the tooltip

Disabled rows are skipped automatically as you move.


Columns

Column alignment

ColumnAlignment sets per-column horizontal alignment:

Value Effect
Left Align cell content to the left (default)
Right Align cell content to the right (typical for numbers)
Center Center cell content

Horizontal scrolling

Tab / Shift+Tab always move the focused column, wrapping around at the first/last column — this works even when every column already fits on screen and nothing needs to scroll; the focused column is always highlighted and reported in the pagination line as Col X/Y. HorizontalScroll only changes what happens once scrolling is actually needed (the columns don’t all fit within the console width):

The focused column’s index is returned as .Content.ColumnIndex.


Layout & border regions


Filtering

When Filter is Contains or StartsWith, typing narrows the visible rows in real time:

Disabled (the default) turns typing off entirely — arrow keys only.


Confirmation & validation flow

Pressing Enter on the focused row:

  1. Validation runs — PredicateSelected / PredicateSelectedAsync, if configured.
  2. Valid → the control closes and returns the row inside a TableSelectResult<T>. Invalid → the table stays open and shows the error line.

Disabled rows cannot be focused for confirmation, so validation typically guards business rules rather than availability.


Initial selection & history


View-only mode

ViewOnly() renders the table for display only:


Options that change behavior

Set per instance via Options(...), or globally on PromptPlus.Config:

Option Effect on TableSelect<T>
EnabledAbortKey(false) Removes Esc — the user must choose
HideAfterFinish(true) Erases the table after confirm — the whole control is erased, not just the interactive part
ShowTooltip(false) Hides the keyboard hint line
Prompt(...) / Description(...) Overrides the prompt / description text

PageSize can be set per control (PageSize) or globally (PromptPlus.Config.PageSize).


Edge cases & gotchas


See also