CheckBox

Description

The CheckBox component is a UI element used for binary selection, allowing users to toggle between two states: checked and unchecked. It provides a simple, clickable interface with an associated label, making it ideal for scenarios where a user chooses one or more items or settings (e.g., "Remember me" options or multi-selection lists).

Usage

Instantiate a CheckBox component using the static helper method from Tesserae.UI. In the sample below, a basic CheckBox is created, with fluent methods to set text, checked state, and disabled state.

API reference

class

CheckBox

public class CheckBox : ComponentBase<CheckBox, HTMLInputElement>, IObservableComponent<bool>, IRoundedStyle, ITextFormating

A two-state form control (checked / unchecked) used for boolean values.

Namespace
Tesserae
Inheritance
ComponentBase<CheckBox, HTMLInputElement> → CheckBox
Implements
IObservableComponent<bool>, IRoundedStyle, ITextFormating

Constructors

NameDescription
CheckBoxInitializes a new instance of this class.
Constructor
CheckBox
public CheckBox(string text = string.Empty)

Initializes a new instance of this class.

Properties

NameDescription
TextGets or sets button text
IsEnabledGets or sets whenever CheckBox is enabled
IsCheckedGets or sets whenever CheckBox is checked
SizeGets or sets the text size.
WeightGets or sets the text weight.
TextAlignGets or sets the text alignment.
Property
CheckBox.Text
public string Text { get ; set ; }

Gets or sets button text

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

Gets or sets whenever CheckBox is enabled

Property
CheckBox.IsChecked
public bool IsChecked { get ; set ; }

Gets or sets whenever CheckBox is checked

Property
CheckBox.Size
public TextSize Size { get ; set ; }

Gets or sets the text size.

Property
CheckBox.Weight
public TextWeight Weight { get ; set ; }

Gets or sets the text weight.

Property
CheckBox.TextAlign
public TextAlign TextAlign { get ; set ; }

Gets or sets the text alignment.

Methods

NameDescription
RenderRenders the component's root HTML element.
DisabledDisables the component.
CheckedMarks the component as checked.
SetTextSets the text of the component.
AsObservableReturns the component's state as a(n) observable.
Method
CheckBox.Render
public override HTMLElement Render()

Renders the component's root HTML element.

Method
CheckBox.Disabled
public CheckBox Disabled(bool value = true)

Disables the component.

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

Marks the component as checked.

Method
CheckBox.SetText
public CheckBox SetText(string text)

Sets the text of the component.

Method
CheckBox.AsObservable
public IObservable<bool> AsObservable()

Returns the component's state as a(n) observable.

Samples

Basic Usage

The following example demonstrates creating a few CheckBox instances with different configurations: unchecked, checked, disabled, and disabled when checked.

See also

  • Toggle
  • Option (for mutually exclusive selections inside a ChoiceGroup)
© 2026 Curiosity. All rights reserved.