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

class

ToggleButton

public class ToggleButton : IComponent

A ToggleButton component that behaves like a button but maintains a checked state.

Namespace
Tesserae
Implements
IComponent

Constructors

NameDescription
ToggleButtonInitializes a new instance of the ToggleButton class.
Constructor
ToggleButton
public ToggleButton(Button button)

Initializes a new instance of the ToggleButton class.

Parameters

button
The button to use as the base for the toggle button.

Properties

NameDescription
IsCheckedGets or sets whether the toggle button is checked.
IsEnabledGets or sets whether the toggle button is enabled.
Property
ToggleButton.IsChecked
public bool IsChecked { get ; set ; }

Gets or sets whether the toggle button is checked.

Property
ToggleButton.IsEnabled
public bool IsEnabled { get ; set ; }

Gets or sets whether the toggle button is enabled.

Methods

NameDescription
OnChangeAdds a change event handler to the toggle button.
RenderRenders the toggle button.
DisabledSets whether the toggle button is disabled.
CheckedSets whether the toggle button is checked.
Method
ToggleButton.OnChange
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.

Method
ToggleButton.Render
public HTMLElement Render()

Renders the toggle button.

Returns

The rendered HTMLElement.

Method
ToggleButton.Disabled
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.

Method
ToggleButton.Checked
public ToggleButton Checked(bool value = true)

Sets whether the toggle button is checked.

Parameters

value
Whether to check the toggle button.

Returns

The current instance of the type.

Events

NameDescription
ChangedEvent fired when the checked state of the toggle button changes.
Event
ToggleButton.Changed
protected event ComponentEventHandler<ToggleButton, Event> Changed

Event fired when the checked state of the toggle button changes.

See also

© 2026 Curiosity. All rights reserved.