☁️ Loving our new documentation website? Provide feedback in the CloudCannon Community! ✨

disabled

Table of contents

Description:

This key defines whether the value of an input is editable in the Data Editor or the sidebar of the Visual Editor or Content Editor.

Disabled inputs are useful if you want CloudCannon to display the input value, but prevent team members from editing the value outside of the Source Editor.

The value of this key can be a boolean or a string. A boolean value of true will prevent team members from editing the value.

A string value can prevent team members from editing an input based on the value of another input.

You can reverse the value with a ! character at the beginning.

  • published hides an input when the sibling input published is truthy
  • !published hides an input when the sibling input published is falsy

For reverse values in YAML files, the string should be in ' or " quotation marks.

By default, this key is false (i.e., team members can edit input values).

Appears in:
└── _inputs
    └── *
        ├── Text Input
        │   └── disabled
        ├── Textarea Input
        │   └── disabled
        ├── Code Input
        │   └── disabled
        ├── Color Input
        │   └── disabled
        ├── Boolean Input
        │   └── disabled
        ├── Number Input
        │   └── disabled
        ├── Range Input
        │   └── disabled
        ├── Rich Text Input
        │   └── disabled
        ├── Date/Datetime Input
        │   └── disabled
        ├── Time Input
        │   └── disabled
        ├── File Input
        │   └── disabled
        ├── URL Input
        │   └── disabled
        ├── Select Input
        │   └── disabled
        ├── Multiselect Input
        │   └── disabled
        ├── Choice Input
        │   └── disabled
        ├── Multichoice Input
        │   └── disabled
        ├── Object Input
        │   └── disabled
        └── Array Input
            └── disabled
Default value:
false
Types:
Booleanboolean#

This key represents a boolean value for the disabled key that toggles whether CloudCannon prevents editing of an input value.

When set to true, CloudCannon prevents team members from editing the input value in the Data Editor or the sidebar of the Visual Editor or Content Editor. The input value is still displayed but cannot be modified outside of the Source Editor.

When set to false, team members can edit the input value normally.

By default, this key is false (i.e., team members can edit input values).

Show examplesHide examples

In this example, we have configured a datetime input to be disabled using a boolean value, preventing editors from modifying the automatically generated date.

Copied to clipboard
_inputs:
  date_created:
    type: datetime
    label: Date of article creation
    disabled: true
    instance_value: NOW
{
  "_inputs": {
    "date_created": {
      "type": "datetime",
      "label": "Date of article creation",
      "disabled": true,
      "instance_value": "NOW"
    }
  }
}

This key represents a query string value for the disabled key that conditionally prevents editing of an input value based on another input's value.

The value is a string that references a sibling input key name. CloudCannon evaluates the referenced input's value to determine whether to disable this input.

When the referenced input is truthy, CloudCannon disables this input. You can reverse this behavior by prefixing the string with !.

For reverse values in YAML files, the string should be wrapped in single or double quotation marks.

Show examplesHide examples

In this example, we have configured an input to be disabled when the published input is truthy.

Copied to clipboard
_inputs:
  published:
    type: checkbox
    label: Published
  edit_date:
    type: datetime
    label: Last edited
    disabled: published
{
  "_inputs": {
    "published": {
      "type": "checkbox",
      "label": "Published"
    },
    "edit_date": {
      "type": "datetime",
      "label": "Last edited",
      "disabled": "published"
    }
  }
}

In this example, we have configured an input to be disabled when the published input is falsy using the ! prefix.

Copied to clipboard
_inputs:
  published:
    type: checkbox
    label: Published
  draft_notes:
    type: textarea
    label: Draft notes
    disabled: '!published'
{
  "_inputs": {
    "published": {
      "type": "checkbox",
      "label": "Published"
    },
    "draft_notes": {
      "type": "textarea",
      "label": "Draft notes",
      "disabled": "!published"
    }
  }
}
Examples:

In this example, we have configured the date_created Date input, which will automatically populate when you create a file using this input. Editors cannot alter this input as the interface is disabled.

Copied to clipboard
_inputs:
  date_created:
    type: datetime
    label: Date of article creation
    comment: UTC +0 timezone
    disabled: true
    instance_value: NOW
    options:
      timezone: Etc/UTC
{
  "_inputs": {
    "date_created": {
      "type": "datetime",
      "label": "Date of article creation",
      "comment": "UTC +0 timezone",
      "disabled": true,
      "instance_value": "NOW",
      "options": {
        "timezone": "Etc/UTC"
      }
    }
  }
}
Open in a new tab