Skip to content
KeystoneJS LogoKeystoneJSv5

Checkbox

The Checkbox field type stores a single Boolean value.

Usage

keystone.createList('Products', {
  fields: {
    name: { type: Text },
    isEnabled: { type: Checkbox, isRequired: true },
    // ...
  },
});

Config

OptionTypeDefaultDescription
isRequiredBooleanfalseDoes this field require a value?

The Checkbox field type doesn't support indexes or unique enforcement.

GraphQL

Uuid fields use the Boolean type in GraphQL.

Input Fields

Field nameTypeDescription
${path}BooleanThe value to be stored

Output Fields

Field nameTypeDescription
${path}BooleanThe stored value

Filters

Field nameTypeDescription
${path}IDMatching the value provided
${path}_notIDNot matching the value provided

Storage

Mongoose Adaptor

In Mongoose the field is added using the Boolean schema type.

The isRequired config option is enforces by KeystoneJS only.

Knex Adaptor

The Knex adaptor uses the Knex boolean type:

The isRequired config option is enforces by KeystoneJS and, if equal to true, the column is set as not nullable.

Have you found a mistake, something that is missing, or could be improved on this page? Please edit the Markdown file on GitHub and submit a PR with your changes.

Edit Page