Light switch field
Allows the editor to set a flag using a light switch.
myLightswitchField:
type: lightswitch
This field definition creates the following input in the control panel:
Attributes
| Property | Description |
|---|---|
| defaultValue | Defines the initial value of the lightswitch. |
| group | Starts a new field group. |
| instructions | Additional instructions for this field in the control panel. Will be shown beneath the field label. |
| label | The primary `label` of the input field in the control panel. When omitted, a label will be generated from the name of the field. |
| rules | The validation rules of the field. |
| width | The width of the field in the control panel. |
defaultValue
Defines the initial value of the light switch.
defaultValue: true
Templating
Printing the light switch field returns the string :code:true or :code:false.
label: Light switch field demo
fields:
lightswitchField:
type: lightswitch
---
{{ lightswitchField }}