Lightswitch Fields

This document is for a version of Craft CMS that is no longer supported. Please refer to the latest version →

Lightswitch fields give you a simple toggle input for times when all you need is a “Yes” or “No” answer.

# The Field

lightswitch-entry.2x

# Templating

This field will either return a 1 or 0 from the database, so you can test if it is in the on position from a template like so:

{% if entry.lightswitchFieldHandle %}
  <p>I'm on!</p>
{% else %}
  <p>I'm off.</p>
{% endif %}