UIToggle

Properties

Name Type
props props
state state

new UIToggle(props)

Create a simple toggle, or checkbox, component

Param Type
props props

Example

import {UIToggle} from 'writer'

render($$) {
    const el = $$('div')
    return el.append(
        $$(UIToggle, {
            id: 'mytoggle',
            label: this.getLabel('My toggle'),
            checked: true,
            onToggle: (checked) => {
                // Do something
            }
        })
    )
}

UIToggle.props

Properties

Name Type Default Description
id string Id of the toggle
label string The text label
[alignRight] boolean false Set to true to have label place to the right
[checked] boolean false Wether the toggle is on or off
[checkbox] boolean false Set to true to render as checkbox instead of toggle
[onToggle] function Callback for when the toggle value changes

UIToggle.state

Properties

Name Type Description
checked bool If the component is toggled or not

results matching ""

    No results matching ""