Skip to content
ConsoleMonster
Class

Toggle

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Implements
IWidget
Modifiers
sealed

A layout checkbox using the form toggle's labels and terminal glyphs.

Inheritance

Usage

Explore 28 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 14

Constructors

public Toggle(string name, bool value = false) #

Creates an on/off input.

Parameters

name string required
The application-state key.
value bool = false optional
The initial value.

Properties

public bool Value { get; set; } #

The committed on/off value. Assignments notify only when the value changes.

public string? OnText { get; set; } #

Text after the checked box; null uses the current language's Yes label.

public string? OffText { get; set; } #

Text after the unchecked box; null uses the current language's No label.

Extension Methods

public static Toggle WithEnabled(Toggle toggle, bool value = true) #

Sets InputControl.Enabled: Whether the control accepts input and participates in focus traversal.

Parameters

toggle ConsoleMonster.Interactive.Toggle required
The instance.
value bool = true optional
The value (default true).

Returns

Toggle The same instance.
public static Toggle WithLabel(Toggle toggle, string? value) #

Sets InputControl.Label: The visible label, or null to use the name.

Parameters

toggle ConsoleMonster.Interactive.Toggle required
The instance.
value string? required
The value.

Returns

Toggle The same instance.
public static Toggle WithOffText(Toggle toggle, string? value) #

Sets Toggle.OffText: Text after the unchecked box; null uses the current language's No label.

Parameters

toggle ConsoleMonster.Interactive.Toggle required
The instance.
value string? required
The value.

Returns

Toggle The same instance.
public static Toggle WithOnText(Toggle toggle, string? value) #

Sets Toggle.OnText: Text after the checked box; null uses the current language's Yes label.

Parameters

toggle ConsoleMonster.Interactive.Toggle required
The instance.
value string? required
The value.

Returns

Toggle The same instance.
public static Toggle WithTabIndex(Toggle toggle, int value) #

Sets InputControl.TabIndex: Focus order; equal values preserve declaration order.

Parameters

toggle ConsoleMonster.Interactive.Toggle required
The instance.
value int required
The value.

Returns

Toggle The same instance.
public static Toggle WithValidationMessage(Toggle toggle, string? value) #

Sets InputControl.ValidationMessage: The current validation message below the control, or null.

Parameters

toggle ConsoleMonster.Interactive.Toggle required
The instance.
value string? required
The value.

Returns

Toggle The same instance.
public static Toggle WithValue(Toggle toggle, bool value = true) #

Sets Toggle.Value: The committed on/off value. Assignments notify only when the value changes.

Parameters

toggle ConsoleMonster.Interactive.Toggle required
The instance.
value bool = true optional
The value (default true).

Returns

Toggle The same instance.