Skip to content

Checkbox

The Checkbox widget provides a boolean input option with a visual checkbox and optional label.

Checkbox displays a checkable box with a label. It supports keyboard activation and provides visual feedback for checked and focus states.

Whether the checkbox is checked.

checkbox.IsChecked = true;

The checkbox label text.

checkbox.Label = "Enable feature";

Color of the checkbox brackets (default: Yellow).

checkbox.BracketColor = Color.Yellow;

Color of the checkmark when checked (default: Green).

checkbox.CheckmarkColor = Color.Green;

Raised when the checked state changes.

checkbox.CheckedChanged += (isChecked) =>
{
Console.WriteLine($"Checked: {isChecked}");
};

Toggles the checkbox state.

checkbox.Toggle();
  • Space or Enter: Toggle checked state
  • Tab: Navigate to next focusable widget
var checkbox = new Checkbox("Enable notifications")
{
X = 10,
Y = 5,
Width = 30,
Height = 1,
ForegroundColor = Color.White,
IsChecked = false
};
checkbox.CheckedChanged += (isChecked) =>
{
Console.WriteLine($"Notifications: {(isChecked ? "ON" : "OFF")}");
};