Skip to content

Checkbox

widgetsinput

Checkbox: a toggleable boolean input with a label

Installation

$ bunx termuijs add checkbox

Copies the source into src/components/checkbox/ and installs @termuijs/core, @termuijs/widgets.

Usage

ts
import { Checkbox } from '@termuijs/widgets'
ts
new Checkbox(label: string, style: Partial<Style> = {}, opts: CheckboxOptions = {},)

API Reference

Checkbox

PropTypeRequiredDescription
labelstringrequired
checkedbooleanoptionalInitial checked state
onChange(checked: boolean) => voidoptionalCallback fired when checked state changes
checkedCharstringoptionalCharacter shown when checked
uncheckedCharstringoptionalCharacter shown when unchecked
disabledbooleanoptionalWhether the checkbox is disabled
checkedColorColoroptionalColor of the check mark
#input#checkbox