Tesserae

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.

Constructors

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

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

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

Event
ToggleButton.Changed
protected event ComponentEventHandler<ToggleButton, Event> Changed

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

See also

© 2026 Tesserae. All rights reserved.