CheckboxWidget
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
A checkbox widget that displays a toggleable checked / unchecked / indeterminate state.
public sealed record CheckboxWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IStatefulWidget<CheckboxWidget, CheckboxState>, IEquatable<CheckboxWidget>Inheritance
Object → Hex1bWidget → CheckboxWidget
Implements
- IEquatable<Hex1bWidget>
- IStatefulWidget<CheckboxWidget, CheckboxState>
- IEquatable<CheckboxWidget>
Constructors
CheckboxWidget(CheckboxValue)
A checkbox widget that displays a toggleable checked / unchecked / indeterminate state.
Parameters:
Value(CheckboxValue): The initial value of the checkbox when the framework manages state. Ignored when an external state instance is supplied via .
public CheckboxWidget(CheckboxValue Value = CheckboxValue.Unchecked)Properties
Value
The initial value of the checkbox when the framework manages state. Ignored when an external state instance is supplied via .
Returns: CheckboxValue
public CheckboxValue Value { get; init; }Methods
Checked()
Sets the checkbox to checked state.
Returns: CheckboxWidget
public CheckboxWidget Checked()Indeterminate()
Sets the checkbox to indeterminate state.
Returns: CheckboxWidget
public CheckboxWidget Indeterminate()Label(string)
Sets the label displayed after the checkbox.
Parameters:
label(String):
Returns: CheckboxWidget
public CheckboxWidget Label(string label)OnToggled(Action<CheckboxToggledEventArgs>)
Sets a synchronous handler called when the checkbox is toggled.
Parameters:
handler(Action<CheckboxToggledEventArgs>):
Returns: CheckboxWidget
public CheckboxWidget OnToggled(Action<CheckboxToggledEventArgs> handler)OnToggled(Func<CheckboxToggledEventArgs, Task>)
Sets an asynchronous handler called when the checkbox is toggled.
Parameters:
handler(Func<CheckboxToggledEventArgs, Task>):
Returns: CheckboxWidget
public CheckboxWidget OnToggled(Func<CheckboxToggledEventArgs, Task> handler)State(CheckboxState)
Returns a copy of the checkbox bound to the supplied state instance. The widget becomes a pure view of state: every reconcile assigns this exact instance to the underlying node, and toggle gestures mutate in place so the parent observes changes without wiring an handler.
Parameters:
state(CheckboxState):
Returns: CheckboxWidget
public CheckboxWidget State(CheckboxState state)Unchecked()
Sets the checkbox to unchecked state.
Returns: CheckboxWidget
public CheckboxWidget Unchecked()Fields
ToggleActionId
Action ID for toggling the checkbox state.
Returns: ActionId
public static readonly ActionId ToggleActionId