SelectionPromptWidget<T>
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
A Spectre-style filtered selection prompt: a focused textbox that filters a list of items as the user types, with inline prediction (Right Arrow autocomplete) of the top match and per-row templates that highlight the substring matched by the current filter.
public sealed record SelectionPromptWidget<T> : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<SelectionPromptWidget<T>>Inheritance
Object → Hex1bWidget → SelectionPromptWidget<T>
Implements
Constructors
SelectionPromptWidget(IReadOnlyList<T>)
A Spectre-style filtered selection prompt: a focused textbox that filters a list of items as the user types, with inline prediction (Right Arrow autocomplete) of the top match and per-row templates that highlight the substring matched by the current filter.
Parameters:
Items(IReadOnlyList<<T>>):
public SelectionPromptWidget(IReadOnlyList<T> Items)Properties
Items
Returns: IReadOnlyList<<T>>
public IReadOnlyList<T> Items { get; init; }Methods
Build(CompositionContext)
Builds the widget tree for this widget. Override this method to author a widget compositionally — by returning a tree of other widgets — without writing a custom .
Parameters:
ctx(CompositionContext): The composition context. Exposes per-instance state via , ambient values via and , and the full fluent widget-building API (ctx.Text(...),ctx.VStack(...),ctx.Button(...), etc.).
Returns: Hex1bWidget
The widget tree to render. Returns null by default, which signals to the framework that this widget does not use the compositional path. Widgets that override this method must return a non-null tree.
protected override Hex1bWidget Build(CompositionContext ctx)Remarks
Unlike a classic Spectre SelectionPrompt, this widget hides items that don't match the filter rather than just scrolling to them.
Focus stays on the textbox; / are forwarded to the list selection, activates the selected item. Mouse clicks on the list update the selection too.
Item matching is case-insensitive substring matching against the string returned by (or item?.ToString() by default).