Skip to content

Checkbox ​

A labeled checkbox with an indeterminate state for partial selection.

Examples ​

Basic usage ​

moonbit
@sumi.checkbox(
  checked=is_checked,
  label="Keep original size",
  on_change=set_checked.map(v => _ => v),
)
@sumi.checkbox(
  checked=false,
  indeterminate=true,
  label="Select all",
  on_change=set_checked.map(v => _ => v),
)

API ​

checkbox ​

NameTypeDefaultDescription
checked *Bool—Whether the control is checked (controlled)
labelString—Label text next to the box
indeterminateBoolfalseMixed state; clicking resolves to checked
on_changeEmit[Bool]—Called when the value changes
disabledBoolfalseBlocks interaction and dims the control
idString—Element id
classString—Extra class names
attrsAttrs—Extra HTML attributes
styleArray[String][]Extra inline styles

* required (labelled) parameter — everything else is optional.