ListWidget
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
Widget for displaying a selectable list of items. Selection state is owned by the node and preserved across reconciliation.
[Obsolete("ListWidget is deprecated. Use ListWidget<T> instead — context.List(items) now returns ListWidget<string>. The non-generic ListWidget is retained for back-compat and will be removed in a future release.", DiagnosticId = "HEX1B0100", UrlFormat = "https://github.com/mitchdenny/hex1b/blob/main/docs/diagnostics/{0}.md")]
public sealed record ListWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<ListWidget>Inheritance
Object → Hex1bWidget → ListWidget
Implements
Constructors
ListWidget(IReadOnlyList<string>)
Widget for displaying a selectable list of items. Selection state is owned by the node and preserved across reconciliation.
Parameters:
Items(IReadOnlyList<String>):
public ListWidget(IReadOnlyList<string> Items)Properties
InitialSelectedIndex
The initial selected index when the list is first created. Defaults to 0 (first item). Only applied when the node is new.
Returns: Int32
public int InitialSelectedIndex { get; init; }Items
Returns: IReadOnlyList<String>
public IReadOnlyList<string> Items { get; init; }Methods
OnItemActivated(Action<ListItemActivatedEventArgs>)
Sets a synchronous handler called when an item is activated (Enter, Space, or click).
Parameters:
handler(Action<ListItemActivatedEventArgs>):
Returns: ListWidget
public ListWidget OnItemActivated(Action<ListItemActivatedEventArgs> handler)OnItemActivated(Func<ListItemActivatedEventArgs, Task>)
Sets an asynchronous handler called when an item is activated (Enter, Space, or click).
Parameters:
handler(Func<ListItemActivatedEventArgs, Task>):
Returns: ListWidget
public ListWidget OnItemActivated(Func<ListItemActivatedEventArgs, Task> handler)OnSelectionChanged(Action<ListSelectionChangedEventArgs>)
Sets a synchronous handler called when the selection changes.
Parameters:
handler(Action<ListSelectionChangedEventArgs>):
Returns: ListWidget
public ListWidget OnSelectionChanged(Action<ListSelectionChangedEventArgs> handler)OnSelectionChanged(Func<ListSelectionChangedEventArgs, Task>)
Sets an asynchronous handler called when the selection changes.
Parameters:
handler(Func<ListSelectionChangedEventArgs, Task>):
Returns: ListWidget
public ListWidget OnSelectionChanged(Func<ListSelectionChangedEventArgs, Task> handler)Fields
Activate
Rebindable action: Activate the selected item.
Returns: ActionId
public static readonly ActionId ActivateMoveDown
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 ScrollUpRemarks
This non-generic widget is preserved for back-compat with existing code that rebinds / / action ids or constructs new ListWidget(items) directly. New code should prefer , which supports custom per-row templates and typed event args. The context.List(items) extension now returns of .