Blair Wadman 1 minute read

How do you create a single on/off checkbox field in Drupal?

Simple on/off checkbox fields where you want the user to select or deselect a checkbox are a common requirement. Yet it is not so obvious how to create them in Drupal.

On/off checkbox fields are often used to toggle for things like:

To create a check box, you first need to add a field with field type of Boolean. Set the widget to Single on/off checkbox.

boolean single on off opton

You will then be presented with the field settings. You don't need to change anything here.

on off settings

On the next screen, select the option to Use field label instead of the "On value" as label. This will ensure that the label for the field is displayed with the field rather than the number 1.

use field label

And that is it! You now have a nice on/off checkbox.

drupal list checkbox

UPDATED 6 Jan: Thanks to everyone who pointed out the boolean type and single on/off widget this out in the comments!