Boolean Field Type

Additional attributes, defaults, and usage example for boolean fields.

Control Type
Method for toggling a boolean value. See control types below for more information. The default is a button group with "On" and "Off" options.
Stored Value
true or false

Usage Example

Here is an example that shows a draft field on a Page model:

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
export default {
  models: {
    Page: {
      fields: [
        { name: 'title', type: 'string', required: true },
        { name: 'draft', type: 'boolean', default: true },
      ],
    },
  },
}

Control Types

The options to adjust the boolean field control are shown below.

button-group (default)

The button group control is the default and is a toggle button with "On" and "Off" options.

  • 1
{ name: 'draft', type: 'boolean', controlType: 'button-group' }
Boolean Button Group - Button Group Control
Boolean Button Group - Button Group Control

checkbox

The checkbox replaces the button group with a single checkbox to the left of the field label.

  • 1
{ name: 'draft', type: 'boolean', controlType: 'checkbox' }
Boolean Button Group - Checkbox Control
Boolean Button Group - Checkbox Control