Toggle
ConsoleMonster.Interactive
A layout checkbox using the form toggle's labels and terminal glyphs.
Inheritance
- InputControl
- Toggle
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.
Returned or exposed by 14
- Extension method Toggle.WithEnabled
- Extension method Toggle.WithLabel
- Extension method Toggle.WithOffText
- Extension method Toggle.WithOnText
- Extension method Toggle.WithTabIndex
- Extension method Toggle.WithValidationMessage
- Extension method Toggle.WithValue
- Method ToggleFluent.WithEnabled
- Method ToggleFluent.WithLabel
- Method ToggleFluent.WithOffText
- Method ToggleFluent.WithOnText
- Method ToggleFluent.WithTabIndex
- Method ToggleFluent.WithValidationMessage
- Method ToggleFluent.WithValue
Accepted by parameters 14
- Extension method Toggle.WithEnabled
- Extension method Toggle.WithLabel
- Extension method Toggle.WithOffText
- Extension method Toggle.WithOnText
- Extension method Toggle.WithTabIndex
- Extension method Toggle.WithValidationMessage
- Extension method Toggle.WithValue
- Method ToggleFluent.WithEnabled
- Method ToggleFluent.WithLabel
- Method ToggleFluent.WithOffText
- Method ToggleFluent.WithOnText
- Method ToggleFluent.WithTabIndex
- Method ToggleFluent.WithValidationMessage
- Method ToggleFluent.WithValue
Constructors
public Toggle(string name, bool value = false) #Creates an on/off input.
Parameters
- name string
- The application-state key.
- value bool = false
- The initial value.
Inherited Methods
public bool HandleInput(InputEvent input, RenderContext context) #Parameters
- input InputEvent
- context RenderContext
Returns
boolpublic Size Measure(Constraints constraints, RenderContext context) #Parameters
- constraints Constraints
- context RenderContext
Returns
Sizepublic void Render(Region region, RenderContext context) #Parameters
- region Region
- context RenderContext
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.
Inherited Properties
Inherited Events
public event EventHandler<AppValueChangedEventArgs>? Changed #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
- The instance.
- value bool = true
- The value (default true).
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
- The instance.
- value string?
- The value.
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
- The instance.
- value string?
- The value.
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
- The instance.
- value string?
- The value.
public static Toggle WithTabIndex(Toggle toggle, int value) #Sets InputControl.TabIndex: Focus order; equal values preserve declaration order.
Parameters
- toggle ConsoleMonster.Interactive.Toggle
- The instance.
- value int
- The value.
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
- The instance.
- value string?
- The value.
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
- The instance.
- value bool = true
- The value (default true).