Skip to content

Checkbox

extends Element

Checkbox: "[x] label", toggles on click, fires "change".

Properties

PropertyTypeDefaultDescription
checkedbooleanfalseChecked state; mirrored to the "checked" element state for styling
textany""label shown right of the box
checkedSymbolany"x"single character inside [ ]
uncheckedSymbolany" "Single character inside [ ] while unchecked
widthnumberdynamicAuto-sizes to the label until set explicitly

Events

EventRegistrarDescription
change:onChange(fn)Fired after every toggle with the new checked state

Methods

Checkbox:setup()

Sets up the checkbox's click handler to toggle its checked state and fire a "change" event.

Checkbox:render(buf)

Renders the checkbox as "[x] label".

  • buf (Render) The render buffer

Last updated:

Released under the MIT License.