Lenra Docs
Register on Lenra
  • Home
  • Getting started
    Open/Close
  • Guides
    Open/Close
  • Features
    Open/Close
  • References
    Open/Close
  • Contribute

    Toggle

    This component can be toggled on or off.

    Examples

    toggle works like a button but with a boolean value.

    Simple toggle

    {
        "type": "toggle",
        // The value is stored in the app data
        "value": data,
        "onPressed": {
            // This listener takes care of toggling the value of this toggle component.
            "code": "toggle",
        }
    },
    

    Properties

    AttributeDescriptionType
    _typeThe type of the element.
    • toggle
    valueThe value of the element.boolean
    autofocusThe default focus in boolean.boolean
    disabledThe toggle is disabled if trueboolean
    dragStartBehaviorDetermines the way that drag start behavior is handled.string
    • start
    • down
    nameThe name that will be used in the form.string
    onPressedListener
    splashRadiusThe splash radius when you click on the toggle.number
    styleElement of type ToggleStyleToggleStyle