Skip to content

CheckboxWidget

Namespace: Hex1b.Widgets

Assembly: Hex1b.dll

A checkbox widget that displays a toggleable checked / unchecked / indeterminate state.

csharp
public sealed record CheckboxWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IStatefulWidget<CheckboxWidget, CheckboxState>, IEquatable<CheckboxWidget>

Inheritance

ObjectHex1bWidgetCheckboxWidget

Implements

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

csharp
public CheckboxValue Value { get; init; }

Methods

Checked()

Sets the checkbox to checked state.

Returns: CheckboxWidget

csharp
public CheckboxWidget Checked()

Indeterminate()

Sets the checkbox to indeterminate state.

Returns: CheckboxWidget

csharp
public CheckboxWidget Indeterminate()

Label(string)

Sets the label displayed after the checkbox.

Parameters:

Returns: CheckboxWidget

csharp
public CheckboxWidget Label(string label)

OnToggled(Action<CheckboxToggledEventArgs>)

Sets a synchronous handler called when the checkbox is toggled.

Parameters:

Returns: CheckboxWidget

csharp
public CheckboxWidget OnToggled(Action<CheckboxToggledEventArgs> handler)

OnToggled(Func<CheckboxToggledEventArgs, Task>)

Sets an asynchronous handler called when the checkbox is toggled.

Parameters:

Returns: CheckboxWidget

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

Returns: CheckboxWidget

csharp
public CheckboxWidget State(CheckboxState state)

Unchecked()

Sets the checkbox to unchecked state.

Returns: CheckboxWidget

csharp
public CheckboxWidget Unchecked()

Fields

ToggleActionId

Action ID for toggling the checkbox state.

Returns: ActionId

csharp
public static readonly ActionId ToggleActionId

Released under the MIT License.