ListWidget<T>
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
Widget for displaying a selectable list of typed items. Selection state is owned by the node and preserved across reconciliation. Supports per-row custom rendering via ItemTemplate — see .
public record ListWidget<T> : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<ListWidget<T>>Inheritance
Object → Hex1bWidget → ListWidget<T>
Implements
Constructors
ListWidget(IReadOnlyList<T>?)
Widget for displaying a selectable list of typed items. Selection state is owned by the node and preserved across reconciliation. Supports per-row custom rendering via ItemTemplate — see .
Parameters:
Items(IReadOnlyList<<T>>):
public ListWidget(IReadOnlyList<T>? Items)Properties
ControlledFocusedIndex
When set, drives the focused index on every reconciliation rather than only at creation time. Use this to build "controlled" lists whose cursor lives in an owning composite's state (e.g. a search-filtered selection prompt where the textbox forwards Up/Down to the list). Out-of-range values are clamped to the current item range.
Returns: Nullable<Int32>
public int? ControlledFocusedIndex { get; init; }InitialFocusedIndex
The initial focused index when the list is first created. Defaults to 0. Only applied when the node is new.
Returns: Int32
public int InitialFocusedIndex { get; init; }InitialSelectedIndex
Legacy alias for . Kept source-compatible with pre-multi-select code that used InitialSelectedIndex; both names target the same backing field.
Returns: Int32
[Obsolete("Use InitialFocusedIndex instead. This alias exists for source compatibility and will be removed in a future release.")]
public int InitialSelectedIndex { get; init; }InitialSelectedIndices
The initial checked set when the list is first created. Defaults to empty. Only applied when the node is new and when multi-select is enabled. Use instead for a controlled (re-applied every frame) checked set.
Returns: IReadOnlyList<Int32>
public IReadOnlyList<int>? InitialSelectedIndices { get; init; }IsMultiSelectEnabled
When true, the list supports multi-select: Space toggles the focused row's checked state, Shift+Arrows extend a range, Ctrl+A selects (or deselects) all, and rendered rows expose the checked state through . When the default row renderer is in use, a checkbox glyph is drawn in front of each row. Set via widget.MultiSelect().
Returns: Boolean
public bool IsMultiSelectEnabled { get; init; }ItemHeight
The fixed row height in terminal rows for each item. Defaults to 1. Templates with content shorter than this are padded; taller content is clipped.
Returns: Int32
public int ItemHeight { get; init; }Items
Returns: IReadOnlyList<<T>>
public IReadOnlyList<T>? Items { get; init; }SelectedIndices
When set, drives the checked set on every reconciliation rather than only at creation time — the controlled-state form of multi-select. Indices outside the current item range are silently dropped. Mutually exclusive with ; if both are set, this wins.
Returns: IReadOnlyList<Int32>
public IReadOnlyList<int>? SelectedIndices { get; init; }Methods
Empty(Func<RootContext, Hex1bWidget>)
Configures an empty-state widget rendered when the list has no items. Mirrors TableWidget<TRow>.Empty(...) — pass a builder that returns the widget tree to render in place of the list contents.
Parameters:
builder(Func<RootContext, Hex1bWidget>): A function that builds the empty-state widget.
Returns: ListWidget`1
public ListWidget<T> Empty(Func<RootContext, Hex1bWidget> builder)Fields
Activate
Rebindable action: Activate the selected item.
Returns: ActionId
public static readonly ActionId ActivateExtendSelectionDown
Rebindable action: Extend the selection one row down from the anchor. Default binding: Shift+DownArrow. Only bound when multi-select is enabled.
Returns: ActionId
public static readonly ActionId ExtendSelectionDownExtendSelectionToFirst
Rebindable action: Extend the selection to the first row. Default binding: Shift+Home. Only bound when multi-select is enabled.
Returns: ActionId
public static readonly ActionId ExtendSelectionToFirstExtendSelectionToLast
Rebindable action: Extend the selection to the last row. Default binding: Shift+End. Only bound when multi-select is enabled.
Returns: ActionId
public static readonly ActionId ExtendSelectionToLastExtendSelectionUp
Rebindable action: Extend the selection one row up from the anchor. Default binding: Shift+UpArrow. Only bound when multi-select is enabled.
Returns: ActionId
public static readonly ActionId ExtendSelectionUpMoveDown
Rebindable action: Move selection down.
Returns: ActionId
public static readonly ActionId MoveDownMoveToFirst
Rebindable action: Move selection to the first item.
Returns: ActionId
public static readonly ActionId MoveToFirstMoveToLast
Rebindable action: Move selection to the last item.
Returns: ActionId
public static readonly ActionId MoveToLastMoveUp
Rebindable action: Move selection up.
Returns: ActionId
public static readonly ActionId MoveUpPageDown
Rebindable action: Move selection down by one viewport.
Returns: ActionId
public static readonly ActionId PageDownPageUp
Rebindable action: Move selection up by one viewport.
Returns: ActionId
public static readonly ActionId PageUpScrollDown
Rebindable action: Scroll down.
Returns: ActionId
public static readonly ActionId ScrollDownScrollUp
Rebindable action: Scroll up.
Returns: ActionId
public static readonly ActionId ScrollUpSelectAll
Rebindable action: Select all rows (or deselect all when every row is already selected). Default binding: Ctrl+A. Only bound when multi-select is enabled.
Returns: ActionId
public static readonly ActionId SelectAllToggleSelection
Rebindable action: Toggle the focused row's checked state. Default binding: Space. Only bound when multi-select is enabled.
Returns: ActionId
public static readonly ActionId ToggleSelection