Skip to content

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.

csharp
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:

csharp
public ToggleSwitchWidget(IReadOnlyList<string> Options, int SelectedIndex = 0)

Properties ​

Options ​

Returns: IReadOnlyList<String>

csharp
public IReadOnlyList<string> Options { get; init; }

SelectedIndex ​

Returns: Int32

csharp
public int SelectedIndex { get; init; }

Methods ​

OnSelectionChanged(Action<ToggleSelectionChangedEventArgs>) ​

Sets a synchronous handler called when the selection changes.

Parameters:

Returns: ToggleSwitchWidget

csharp
public ToggleSwitchWidget OnSelectionChanged(Action<ToggleSelectionChangedEventArgs> handler)

OnSelectionChanged(Func<ToggleSelectionChangedEventArgs, Task>) ​

Sets an asynchronous handler called when the selection changes.

Parameters:

Returns: ToggleSwitchWidget

csharp
public ToggleSwitchWidget OnSelectionChanged(Func<ToggleSelectionChangedEventArgs, Task> handler)

Fields ​

NextOptionActionId ​

Action ID for moving to the next option.

Returns: ActionId

csharp
public static readonly ActionId NextOptionActionId

PreviousOptionActionId ​

Action ID for moving to the previous option.

Returns: ActionId

csharp
public static readonly ActionId PreviousOptionActionId

SelectOptionActionId ​

Action ID for selecting an option via mouse click.

Returns: ActionId

csharp
public static readonly ActionId SelectOptionActionId

Released under the MIT License.