ToggleButton
Description
A button that maintains a checked state. Created by calling .ToToggle() on an existing Button, so all standard button styling (icons, sizes, colours, hotkeys) is inherited.
Usage
API reference
public class ToggleButton : IComponentA ToggleButton component that behaves like a button but maintains a checked state.
- Namespace
- Tesserae
- Implements
- IComponent
Constructors
| Name | Description |
|---|---|
| ToggleButton | Initializes a new instance of the ToggleButton class. |
Properties
| Name | Description |
|---|---|
| IsChecked | Gets or sets whether the toggle button is checked. |
| IsEnabled | Gets or sets whether the toggle button is enabled. |
public bool IsChecked { get ; set ; }Gets or sets whether the toggle button is checked.
Methods
| Name | Description |
|---|---|
| OnChange | Adds a change event handler to the toggle button. |
| Render | Renders the toggle button. |
| Disabled | Sets whether the toggle button is disabled. |
| Checked | Sets whether the toggle button is checked. |
public ToggleButton OnChange(ComponentEventHandler<ToggleButton, Event> onChange)Adds a change event handler to the toggle button.
Parameters
- onChange
- The event handler.
Returns
The current instance of the type.
public HTMLElement Render()Renders the toggle button.
Returns
The rendered HTMLElement.
public ToggleButton Disabled(bool value = true)Sets whether the toggle button is disabled.
Parameters
- value
- Whether to disable the toggle button.
Returns
The current instance of the type.
Events
| Name | Description |
|---|---|
| Changed | Event fired when the checked state of the toggle button changes. |