Recent searches

in

Disabled Input

On this page

This input type is deprecated. Use another input type with disabled set to true instead.

This key defines a read-only editing interface for plain text.

This input type is deprecated. It is still supported, but you should use the input type that matches your data and set disabled: true instead. This gives you the same read-only behavior with the appropriate interface for your value, and works with disabled_if for conditional read-only inputs.

Appears in#

└── _inputs
    └── *
        └── Disabled Input

Type#

Object Deprecated

Properties#

cascade — boolean#

This key defines whether CloudCannon should merge this input configuration with any matching, less specific configurations elsewhere in the configuration cascade.

The configuration cascade works by finding the most specific _inputs entry.

Usually, once an option is found in the cascade, there's no reason to keep looking.

When this key is true, the cascade continues looking and each entry found is merged.

This key allows you to define some options globally while using specific options for other keys at different levels of the cascade.

For example, define a comment globally, but use collection-specific label for inputs in different collections.

You can stop the cascade at any point in the configuration cascade by setting cascade to false.

Defaults to: true

Appears in: Text Input, Disabled Input, Textarea Input, Code Input, Color Input, Boolean Input, Number Input, Range Input, Rich Text Input, URL Input, Select Input, Date/Datetime Input, Time Input, File Input, Multiselect Input, Choice Input, Multichoice Input, Object Input, Array Input.

Show examplesHide examples

In this example, we have configured cascade to merge input configurations across the configuration cascade.

Copied to clipboard
_inputs:
  title:
    type: text
    cascade: true
    comment: Global comment for all title inputs
{
  "_inputs": {
    "title": {
      "type": "text",
      "cascade": true,
      "comment": "Global comment for all title inputs"
    }
  }
}
comment — string#

This key defines the subtitle text above an Input.

CloudCannon supports a limited selection of Markdown formatting for the value of this key: links, bold, italic, subscript, superscript, and inline code.

This key has no default.

Appears in: Text Input, Disabled Input, Textarea Input, Code Input, Color Input, Boolean Input, Number Input, Range Input, Rich Text Input, URL Input, Select Input, Date/Datetime Input, Time Input, File Input, Multiselect Input, Choice Input, Multichoice Input, Object Input, Array Input.

Show examplesHide examples

In this example, we want to add helpful guidance for our page_description Input.

Copied to clipboard
_inputs:
  page_description:
    type: text
    label: Page Description
    comment: Enter a brief description of this page for search engines
{
  "_inputs": {
    "page_description": {
      "type": "text",
      "label": "Page Description",
      "comment": "Enter a brief description of this page for search engines"
    }
  }
}
context — Object#

This key defines a context box for extra information about an Input.

This key has no default.

Appears in: Text Input, Disabled Input, Textarea Input, Code Input, Color Input, Boolean Input, Number Input, Range Input, Rich Text Input, URL Input, Select Input, Date/Datetime Input, Time Input, File Input, Multiselect Input, Choice Input, Multichoice Input, Object Input, Array Input.

Show examplesHide examples

In this example, we want to add a context box to our date_created Input to explain its purpose.

Copied to clipboard
_inputs:
  date_created:
    type: datetime
    label: Date of article creation
    instance_value: NOW
    context:
      open: false
      title: Help
      icon: help
      content: This date field will automatically populate when you create an article.
{
  "_inputs": {
    "date_created": {
      "type": "datetime",
      "label": "Date of article creation",
      "instance_value": "NOW",
      "context": {
        "open": false,
        "title": "Help",
        "icon": "help",
        "content": "This date field will automatically populate when you create an article."
      }
    }
  }
}

This key toggles whether CloudCannon will rehydrate inputs configured with an instance_value with a new value when duplicated.

Setting this key to true will prevent rehydration of instance values when inputs are duplicated.

Defaults to: false

Appears in: Text Input, Disabled Input, Textarea Input, Code Input, Color Input, Boolean Input, Number Input, Range Input, Rich Text Input, URL Input, Select Input, Date/Datetime Input, Time Input, File Input, Multiselect Input, Choice Input, Multichoice Input, Object Input, Array Input.

Show examplesHide examples

In this example, CloudCannon will prevent rehydration of instance values when inputs are duplicated.

Copied to clipboard
_inputs:
  id:
    type: text
    instance_value: UUID
    disable_instance_value_rehydration: true
{
  "_inputs": {
    "id": {
      "type": "text",
      "instance_value": "UUID",
      "disable_instance_value_rehydration": true
    }
  }
}

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).

Defaults to: false

Appears in: Text Input, Disabled Input, Textarea Input, Code Input, Color Input, Boolean Input, Number Input, Range Input, Rich Text Input, URL Input, Select Input, Date/Datetime Input, Time Input, File Input, Multiselect Input, Choice Input, Multichoice Input, Object Input, Array Input.

Show examplesHide 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"
      }
    }
  }
}
disabled_if — string#

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 using an expression.

CloudCannon prevents editing the input when the expression is truthy, and re-evaluates it whenever an input it references changes.

Expressions reference other inputs by key and support comparisons (⁠==, !=, ===, !==, <, <=, >, >=⁠), logic (⁠&&, ||, !, ??⁠), and arithmetic. Two names are reserved:

  • this is the input being configured.
  • $ is the root of the file, or the closest structure value when the input is inside a structure.

Functions:

  • parent(input, levels) is the object or array levels above input. Both are optional: input defaults to this and levels to 1, so parent() is the object or array containing the input, parent(2) is the one above that, and parent($) is the one containing the structure value.
  • get(input, ...keys) follows a path of keys or array indexes starting at input. input is optional and defaults to the object containing the input, so get("my key") reads a sibling with any key, get("seo", "title") reads a nested value, and get(parent(2), "my key") reads from elsewhere.
  • length, includes, starts_with, ends_with, lowercase, uppercase, trim, number, and string operate on values.

Configuration on an array item, such as items[*], uses parent(2) to reach the inputs beside the array.

An expression that fails to parse shows an error in place of the input, which is not editable.

If both disabled_if and disabled are set, the input is disabled when either is truthy.

Appears in: Text Input, Disabled Input, Textarea Input, Code Input, Color Input, Boolean Input, Number Input, Range Input, Rich Text Input, URL Input, Select Input, Date/Datetime Input, Time Input, File Input, Multiselect Input, Choice Input, Multichoice Input, Object Input, Array Input.

Show examplesHide examples

In this example, published is unchecked, so the publish_date input is read-only until it is checked.

Copied to clipboard
published: false
publish_date: 
_inputs:
  published:
    type: checkbox
  publish_date:
    type: datetime
    disabled_if: '!published'
{
  "published": false,
  "publish_date": null,
  "_inputs": {
    "published": {
      "type": "checkbox"
    },
    "publish_date": {
      "type": "datetime",
      "disabled_if": "!published"
    }
  }
}

In this example, there is stock on hand, so the emergency_stock_count input is read-only until stock_count reaches zero.

Copied to clipboard
stock_count: 3
emergency_stock_count: 0
_inputs:
  stock_count:
    type: number
  emergency_stock_count:
    type: number
    disabled_if: stock_count > 0
{
  "stock_count": 3,
  "emergency_stock_count": 0,
  "_inputs": {
    "stock_count": {
      "type": "number"
    },
    "emergency_stock_count": {
      "type": "number",
      "disabled_if": "stock_count > 0"
    }
  }
}

In this example, locked is checked, so every item in items is read-only. Each item is inside the array, so parent(2) reaches the locked input beside it.

Copied to clipboard
locked: true
items:
  - Apples
  - Pears
_inputs:
  locked:
    type: checkbox
  items:
    type: array
  items[*]:
    type: text
    disabled_if: parent(2).locked
{
  "locked": true,
  "items": [
    "Apples",
    "Pears"
  ],
  "_inputs": {
    "locked": {
      "type": "checkbox"
    },
    "items": {
      "type": "array"
    },
    "items[*]": {
      "type": "text",
      "disabled_if": "parent(2).locked"
    }
  }
}

This key defines a message shown above an input while it is disabled, to explain why the value cannot be edited.

The message is shown when disabled is true or disabled_if is truthy, and hidden otherwise.

CloudCannon supports a limited selection of Markdown formatting for the value of this key: links, bold, italic, subscript, superscript, and inline code.

This key has no default.

Appears in: Text Input, Disabled Input, Textarea Input, Code Input, Color Input, Boolean Input, Number Input, Range Input, Rich Text Input, URL Input, Select Input, Date/Datetime Input, Time Input, File Input, Multiselect Input, Choice Input, Multichoice Input, Object Input, Array Input.

Show examplesHide examples

In this example, published is checked, so the slug input is read-only and shows the message explaining why.

Copied to clipboard
published: true
slug: launch-week
_inputs:
  published:
    type: checkbox
  slug:
    type: text
    disabled_if: published
    disabled_message: Unpublish this post to change its URL.
{
  "published": true,
  "slug": "launch-week",
  "_inputs": {
    "published": {
      "type": "checkbox"
    },
    "slug": {
      "type": "text",
      "disabled_if": "published",
      "disabled_message": "Unpublish this post to change its URL."
    }
  }
}
documentation — Object#

This key defines the documentation link at the top of a Collection browser.

Collection documentation is useful for assisting your team members.

Appears in: collections_config.*, Text Input, Disabled Input, Textarea Input, Code Input, Color Input, Boolean Input, Number Input, Range Input, Rich Text Input, URL Input, Select Input, Date/Datetime Input, Time Input, File Input, Multiselect Input, Choice Input, Multichoice Input, Object Input, groups[*], [*], options.entries, groups[*], Array Input.

Show examplesHide examples

In this example, the documentation link for the data Collection goes to CloudCannon Documentation.

Copied to clipboard
collections_config:
  data:
    documentation:
      url: https://cloudcannon.com/documentation/
      text: CloudCannon Documentation
      icon: star
{
  "collections_config": {
    "data": {
      "documentation": {
        "url": "https://cloudcannon.com/documentation/",
        "text": "CloudCannon Documentation",
        "icon": "star"
      }
    }
  }
}

This key defines the visibility of an input in the Data Editor or the sidebar of the Visual Editor or Content Editor.

Hidden inputs are useful when you want an input to exist, but not be visible or editable outside of the Source Editor.

Value can be a boolean or a string. A boolean value of true will hide the input.

A string value can hide 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 follows the input naming convention where key names beginning with an underscore are hidden true.

Defaults to: false

Appears in: Text Input, Disabled Input, Textarea Input, Code Input, Color Input, Boolean Input, Number Input, Range Input, Rich Text Input, URL Input, Select Input, Date/Datetime Input, Time Input, File Input, Multiselect Input, Choice Input, Multichoice Input, Object Input, Array Input.

hidden_if — string#

This key defines the visibility of an input in the Data Editor or the sidebar of the Visual Editor or Content Editor using an expression.

CloudCannon hides the input when the expression is truthy, and re-evaluates it whenever an input it references changes.

Expressions reference other inputs by key and support comparisons (⁠==, !=, ===, !==, <, <=, >, >=⁠), logic (⁠&&, ||, !, ??⁠), and arithmetic. Two names are reserved:

  • this is the input being configured.
  • $ is the root of the file, or the closest structure value when the input is inside a structure.

Functions:

  • parent(input, levels) is the object or array levels above input. Both are optional: input defaults to this and levels to 1, so parent() is the object or array containing the input, parent(2) is the one above that, and parent($) is the one containing the structure value.
  • get(input, ...keys) follows a path of keys or array indexes starting at input. input is optional and defaults to the object containing the input, so get("my key") reads a sibling with any key, get("seo", "title") reads a nested value, and get(parent(2), "my key") reads from elsewhere.
  • length, includes, starts_with, ends_with, lowercase, uppercase, trim, number, and string operate on values.

Configuration on an array item, such as items[*], uses parent(2) to reach the inputs beside the array.

An expression that fails to parse shows an error in place of the input, which remains visible.

If both hidden_if and hidden are set, the input is hidden when either is truthy.

Appears in: Text Input, Disabled Input, Textarea Input, Code Input, Color Input, Boolean Input, Number Input, Range Input, Rich Text Input, URL Input, Select Input, Date/Datetime Input, Time Input, File Input, Multiselect Input, Choice Input, Multichoice Input, Object Input, Array Input.

Show examplesHide examples

In this example, type is video, so the video_path input is shown and the image_path input is hidden. Changing type swaps them.

Copied to clipboard
type: video
image_path: 
video_path: /uploads/launch.mp4
_inputs:
  type:
    type: select
    options:
      values:
        - image
        - video
  image_path:
    type: image
    hidden_if: type != "image"
  video_path:
    type: file
    hidden_if: type != "video"
{
  "type": "video",
  "image_path": null,
  "video_path": "/uploads/launch.mp4",
  "_inputs": {
    "type": {
      "type": "select",
      "options": {
        "values": [
          "image",
          "video"
        ]
      }
    },
    "image_path": {
      "type": "image",
      "hidden_if": "type != \"image\""
    },
    "video_path": {
      "type": "file",
      "hidden_if": "type != \"video\""
    }
  }
}

In this example, forced_theme is set at the root of the file, so the use_dark_mode input inside hero is hidden. It is shown again when forced_theme is cleared.

Copied to clipboard
forced_theme: dark
hero:
  title: Welcome
  use_dark_mode: false
_inputs:
  forced_theme:
    type: select
    options:
      values:
        - light
        - dark
  hero.use_dark_mode:
    type: checkbox
    hidden_if: $.forced_theme != null
{
  "forced_theme": "dark",
  "hero": {
    "title": "Welcome",
    "use_dark_mode": false
  },
  "_inputs": {
    "forced_theme": {
      "type": "select",
      "options": {
        "values": [
          "light",
          "dark"
        ]
      }
    },
    "hero.use_dark_mode": {
      "type": "checkbox",
      "hidden_if": "$.forced_theme != null"
    }
  }
}

In this example, there is no stock on hand but some on order, so the out_of_stock_reason input stays hidden until both counts reach zero.

Copied to clipboard
stock_count: 0
ordered_stock_count: 12
out_of_stock_reason: 
_inputs:
  stock_count:
    type: number
  ordered_stock_count:
    type: number
  out_of_stock_reason:
    type: textarea
    hidden_if: (stock_count + ordered_stock_count) > 0
{
  "stock_count": 0,
  "ordered_stock_count": 12,
  "out_of_stock_reason": null,
  "_inputs": {
    "stock_count": {
      "type": "number"
    },
    "ordered_stock_count": {
      "type": "number"
    },
    "out_of_stock_reason": {
      "type": "textarea",
      "hidden_if": "(stock_count + ordered_stock_count) > 0"
    }
  }
}
instance_value — string#

This key defines whether an Input is automatically populated with a value when the creating a new file, or adding array items containing this Input. Setting this key to UUID populates the Input with a uuidv4 key (e.g. 6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b⁠) for identifying unique items (extremely unlikely to generate duplicates), and to NOW populates the Input with the current datetime in the Site's configured timezone.

Allowed values: UUID NOW

Appears in: Text Input, Disabled Input, Textarea Input, Code Input, Color Input, Boolean Input, Number Input, Range Input, Rich Text Input, URL Input, Select Input, Date/Datetime Input, Time Input, File Input, Multiselect Input, Choice Input, Multichoice Input, Object Input, Array Input.

Show examplesHide examples

In this example, we have configured an input to automatically populate with a UUID when created.

Copied to clipboard
_inputs:
  id:
    type: text
    instance_value: UUID
{
  "_inputs": {
    "id": {
      "type": "text",
      "instance_value": "UUID"
    }
  }
}
label — string#

This key defines the bold title text above an Input.

Appears in: Text Input, Disabled Input, Textarea Input, Code Input, Color Input, Boolean Input, Number Input, Range Input, Rich Text Input, URL Input, Select Input, Date/Datetime Input, Time Input, File Input, Multiselect Input, Choice Input, Multichoice Input, Object Input, Array Input.

Show examplesHide examples

In this example, we want to customize the label for our page_title Input to be more descriptive.

Copied to clipboard
_inputs:
  page_title:
    type: text
    label: Article Title
    comment: Enter the main title for this article
{
  "_inputs": {
    "page_title": {
      "type": "text",
      "label": "Article Title",
      "comment": "Enter the main title for this article"
    }
  }
}
options — Object#

This key defines options that are specific to Text Inputs.

Appears in: Text Input, Disabled Input.

Show examplesHide examples

In this example, we have configured Text Input options including comment and icon.

Copied to clipboard
_inputs:
  title:
    type: text
    options:
      comment: Enter a title
      icon: title
{
  "_inputs": {
    "title": {
      "type": "text",
      "options": {
        "comment": "Enter a title",
        "icon": "title"
      }
    }
  }
}
type — "disabled" Required#

Sets an input type, which controls how this input appears and behaves.

Appears in: Disabled Input.

Open in a new tab