Reference

Guide

Toggle

Yes/no or on/off toggle

The toggle field is perfect for simple on/off or yes/no states.

Example

fields:
  toggle:
    label: Toggle
    type: toggle
    text: Include in menu?

Field properties

Property Type Required Default Description
after mixed Optional text that will be shown after the input
autofocus bool Sets the focus on this field when the form loads. Only the first field with this label gets
before mixed Optional text that will be shown before the input
default mixed Default value which will be saved when a new page/user/file is created
disabled bool If true, the field is no longer editable and will not be saved
help mixed Optional help text below the field
icon string Optional icon that will be shown at the end of the field
label mixed The field label can be set as string or associative array with translations
required bool If true, the field has to be filled in correctly to be saved.
text mixed Sets the text next to the toggle. The text can be a string or an array of two options. The first one is the negative text and the second one the positive. The text will automatically switch when the toggle is triggered.
translate bool true If false, the field will be disabled in non-default languages and cannot be translated. This is only relevant in multi-language setups.
when mixed Conditions when the field will be shown
width string 1/1 The width of the field in the field grid. Available widths: 1/1, 1/2, 1/3, 1/4, 2/3, 3/4

Simple toogle field translated

fields:
  toggle:
    label: Toggle
    type: toggle
    text:
        en: Include in menu?
        de: Im Menü anzeigen?

Text toggle

fields:
  toggle:
    label: Toggle
    type: toggle
    text:
        - Nope
        - Yay

Text toggle translated

fields:
  toggle:
    label: Toggle
    type: toggle
    text:
        -
            en: Nope
            de: Och nö
        -
            en: Yay
            de: Juhu

The field content will either be 'true' or 'false'.