ToggleSwitchWidget
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
A horizontal toggle switch widget that allows selecting between multiple options. Use arrow keys (left/right) to switch between options when focused. Selection state is owned by the node and preserved across reconciliation.
public sealed record ToggleSwitchWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<ToggleSwitchWidget>Inheritance
Object → Hex1bWidget → ToggleSwitchWidget
Implements
Constructors
ToggleSwitchWidget(IReadOnlyList<string>, int)
A horizontal toggle switch widget that allows selecting between multiple options. Use arrow keys (left/right) to switch between options when focused. Selection state is owned by the node and preserved across reconciliation.
Parameters:
Options(IReadOnlyList<String>):SelectedIndex(Int32):
public ToggleSwitchWidget(IReadOnlyList<string> Options, int SelectedIndex = 0)Properties
Options
Returns: IReadOnlyList<String>
public IReadOnlyList<string> Options { get; init; }SelectedIndex
Returns: Int32
public int SelectedIndex { get; init; }Methods
OnSelectionChanged(Action<ToggleSelectionChangedEventArgs>)
Sets a synchronous handler called when the selection changes.
Parameters:
handler(Action<ToggleSelectionChangedEventArgs>):
Returns: ToggleSwitchWidget
public ToggleSwitchWidget OnSelectionChanged(Action<ToggleSelectionChangedEventArgs> handler)OnSelectionChanged(Func<ToggleSelectionChangedEventArgs, Task>)
Sets an asynchronous handler called when the selection changes.
Parameters:
handler(Func<ToggleSelectionChangedEventArgs, Task>):
Returns: ToggleSwitchWidget
public ToggleSwitchWidget OnSelectionChanged(Func<ToggleSelectionChangedEventArgs, Task> handler)Fields
NextOptionActionId
Action ID for moving to the next option.
Returns: ActionId
public static readonly ActionId NextOptionActionIdPreviousOptionActionId
Action ID for moving to the previous option.
Returns: ActionId
public static readonly ActionId PreviousOptionActionIdSelectOptionActionId
Action ID for selecting an option via mouse click.
Returns: ActionId
public static readonly ActionId SelectOptionActionId