📑 Creates a checkbox element.
Use the checked property to get or set the checkbox's state.
checked
The label property is the text label element next to the checkbox.
label
Optional
text label placed next to the checkbox
initial state
await Canvas(200, 100);let box = createCheckbox('Check me!');box.label.style.color = 'lime';box.addEventListener('input', () => { if (box.checked) background('lime'); else background('black');}); Copy
await Canvas(200, 100);let box = createCheckbox('Check me!');box.label.style.color = 'lime';box.addEventListener('input', () => { if (box.checked) background('lime'); else background('black');});
📑 Creates a checkbox element.
Use the
checkedproperty to get or set the checkbox's state.The
labelproperty is the text label element next to the checkbox.