Boolean Field Reference

This article explains what the Boolean field is and how to configure it in the Custom Type builder.


The Boolean field allows content writers to select a “true” or “false” value. When you add this field in a Custom Type, it'll be available as a toggle in the documents. You can add custom placeholder values to make it user-friendly.

The following are the instructions to configure a Boolean field in a Custom Type.

Screenshot of the Boolean field in the drag-and-drop editor.

The visual builder

When configuring a Boolean field, you'll see the options to set the Field name and API ID. You can also assign placeholder values for each one. Finally, you can click the checkbox to have the first value default to true.

Slice Machine vs. Legacy Editor

Editing fields is almost identical in Slice Machine and the Legacy editor. But it is important to know that the mock config option (to add data to preview content fields in the Slice Simulator) is only available in Slice Machine.

Screenshot of the Boolean field editor.

Please note that when you add a new Boolean field with a default value to a Custom Type with existing documents, these existing documents will not be automatically updated with the default value. You'll need to re-publish them for the new value to take effect.

JSON model

The following table displays the JSON keys and values of the field’s 'API response.

Edit the JSON model with caution

Only edit the JSON model to make changes to the Rich Text field labels. Making abrupt changes can cause conflicts when synchronizing changes with your documents.

type

string (required)

The value must be Boolean

config

object

Object for the configuration options

config.label

string

The label that shows up for the field in the document editor

config.placeholder_false

string

A user-friendly placeholder for the field's false value

config.placeholder_true

string

A user-friendly placeholder for the field's true value

config.default_value

string

Selecting this option will default the value to be true

Example JSON configuration

The following JSON defines a Boolean field that defaults to true:

Copy
"example_boolean": {
   "type": "Boolean",
   "config": {
     "placeholder_false": "Label for the False value...",
     "placeholder_true": "Label for the True value..."
     "default_value": true,
     "label": "boolean"
  }
}

API response example

Here is an API response example of a Boolean field with the API ID of example_boolean:

Copy
// API response example of a Boolean field

{
 //...
 "example_boolean": true
}

Was this article helpful?
Not really
Yes, Thanks

Can't find what you're looking for? Spot an error in the documentation? Get in touch with us on our Community Forum or using the feedback form above.