Skip to content

Checkbox

Checkbox represents a controlled on/off choice that can be selected independently of neighboring checkboxes.

Checkbox("Include diagnostics", include_diagnostics)
.OnChanged([include_diagnostics](bool checked) {
include_diagnostics = checked;
})

Construct it with a bool or State<bool>, with or without a StringVariant label. The state overload reads the current value; OnChanged emits the requested next value and does not mutate the state automatically.

The shared activation path supports pointer input, Enter, and Space. Enabled(false) disables activation and applies disabled styling.

CheckboxStyle controls box size, interactive and state-layer size, checked fill, checkmark, unchecked border, disabled colors, border width, and radius. Checkbox role, checked state, label, focus, and activate action are exposed automatically to accessibility services.

  • Constructors: Checkbox(bool|State<bool>) and Checkbox(StringVariant, bool|State<bool>).
  • Event: .OnChanged(function) with bool.
  • Theme style: CheckboxStyle.

Use RadioButton for one choice in a mutually exclusive group and Switch for an immediately applied setting.