Skip to content

Lightswitch

Craft’s signature on/off toggle. Prefer this over a checkbox for a single boolean setting. It renders as a <button role="switch"> with a hidden input, so it submits like a normal field.

On Off Small
{{ forms.lightswitchField({
    label: "Enable this feature"|t("my-plugin"),
    instructions: "Turn on to expose the widget."|t("my-plugin"),
    name: "enabled",
    on: settings.enabled,
}) }}