Table of Contents

Class InlineSelectWidget

Namespace
ItTiger.TigerCli.Tui.Widgets
Assembly
ItTiger.TigerCli.dll
A reusable single-selection list widget.
public sealed class InlineSelectWidget : InlineWidget, ICliRenderable
Inheritance
InlineSelectWidget
Implements
Inherited Members

Constructors

InlineSelectWidget(ICliAppShell, IReadOnlyList<string?>, int?, CliFormattingMode, int?, int?)

Creates a single-selection list widget.
public InlineSelectWidget(ICliAppShell shell, IReadOnlyList<string?> labels, int? preselectIndex = null, CliFormattingMode itemsFormattingMode = CliFormattingMode.Raw, int? minWidth = null, int? maxWidth = null)

Parameters

shell ICliAppShell
The shell that supplies the theme, culture, and viewport.
labels IReadOnlyList<string>
The labels to display; a null label represents a no-selection row.
preselectIndex int?
The initially selected index, or null for the first label.
itemsFormattingMode CliFormattingMode
How labels are formatted.
minWidth int?
The optional minimum width in cells.
maxWidth int?
The optional maximum width in cells.

Properties

EmptyStateTextOverride

Optional text displayed when the list contains no items.
public string? EmptyStateTextOverride { get; set; }

Property Value

string

Labels

The labels currently displayed by the widget.
public IReadOnlyList<string?> Labels { get; }

Property Value

IReadOnlyList<string>

SelectedIndex

The selected index, or -1 when the list is empty.
public int SelectedIndex { get; }

Property Value

int

SelectedValue

The selected label, or null for an empty list or a selected no-selection row.
public string? SelectedValue { get; }

Property Value

string

Methods

HandleKey(KeyEvent)

Handles a key. Returns whether it was consumed and any requested dialog result.
public override InlineKeyResult HandleKey(KeyEvent key)

Parameters

key KeyEvent

Returns

InlineKeyResult

SetItems(IReadOnlyList<string?>, int?)

Replaces the displayed labels and selects an item in the new list.
public void SetItems(IReadOnlyList<string?> labels, int? selectedIndex = null)

Parameters

labels IReadOnlyList<string>
The replacement labels.
selectedIndex int?
The selected index, or null for the first item.

ToGrid()

Converts the component into a grid for measurement and rendering.
public override CliGrid ToGrid()

Returns

CliGrid