UICheckbox

Create a simple checkbox

Since: 6.4.0 (6.1.0)

NameTypeDefaultDescription

id

string

Required - Id of the checkbox

label

string

Required - The text label

checked

boolean

false

Wether the checkbox is checked or not

disabled

boolean

false

Wether the checkbox is disabled or not

checkboxPosition

string

"left"

Decide checkbox position against label

type

string

"default"

Type definition

onChange

function

Callback for when the checkbox value changes

Example

import {UICheckbox} from 'writer'

render($$) {
    const el = $$('div')
    return el.append(
        $$(UICheckbox, {
            id: 'myCheckbox',
            label: this.getLabel('Checky checkbox'),
            checkboxPosition: 'right'
            checked: true,
            onChange: (checked) => {
                // Do something
            }
        })
    )
}

Last updated