Platform
Templates
Partials
Schema reference

Partial schema reference

Learn more about partial schemas and available fields for partials.

When using HTML partials, you can create an optional schema for your partial to set field types, default values, and require inputs for variables that are passed into the partial.

Partial schemas support the following field types:

Field typeDescription
TextSingle-line text input field.
MarkdownMarkdown-formatted text input that supports formatting syntax.
TextareaMulti-line text input field for longer content.
BooleanTrue/false checkbox or toggle field.
SelectDropdown selection field for choosing a single option. Useful for expressing enums.
Multi-selectDropdown selection field for choosing multiple options.
ButtonButton configuration field for text, link, and styling options.
URLURL input field with validation.
ImageImage upload or URL field for displaying images.
JSONJSON input field with schema validation.

Fields

#

All fields must have:

  • type: The type of the field to render (see below)
  • key: A unique key for the field in the variant
  • label: A label to render

Field types

#

Text

#

A plain text, single line text field.

Settings

#
requiredboolean

Indicates this field is required

descriptionstring

An optional friendly description

defaultstring

The default value to display

minLengthinteger

The minimum length to validate

maxLengthinteger

The maximum length to validate against

Example

Markdown

#

A markdown editor for creating rich text. Will always be rendered as HTML.

Settings

#
requiredboolean

Indicates this field is required

descriptionstring

An optional friendly description

defaultstring

The default value to display

Example

#

Textarea

#

A multi-line plain text area

Settings

#
requiredboolean

Indicates this field is required

descriptionstring

An optional friendly description

defaultstring

The default value to display

minLengthinteger

The minimum length to validate

maxLengthinteger

The maximum length to validate against

Example

#

Boolean

#

A checkbox that returns either true or false (checked or unchecked).

Settings

#
requiredboolean

Indicates this field is required

descriptionstring

An optional friendly description

defaultboolean

The default value to set

Example

#

Select

#

A single select box that defines a static list of options for editors to pick from.

Settings

#
optionsobject[]

A list of option objects that must include a label and a value

requiredboolean

Indicates this field is required

defaultstring

The value of the default option to set

Example

#

Usage

#

In your template preview, you can access the value of the selected option using the field's key. For example:

Multi-select

#

A multi-select box that defines a static list of options for editors to pick from.

Settings

#
optionsobject[]

A list of option objects that must include a label and a value

requiredboolean

Indicates this field is required

defaultstring[]

The values of the default options to set

Example

#

Usage

#

In your template preview, you can access the selected values using the field's key. For example:

Button

#

A button, with text to display and an action to perform when clicked.

Every button field contains two subfields:

textstring

A text field that represents the button's text

actionstring

A text field that represents the button's action

Settings

#
requiredboolean

Indicates this field is required

descriptionstring

An optional friendly description

Example

#

URL

#

Settings

#
requiredboolean

Indicates this field is required

descriptionstring

An optional friendly description

defaultstring

The default URL to display

Example

#

Image

#

An image field, used to display an image with alt text and an optional action to perform when clicked.

Every image field contains three subfields:

urlstring

A URL field that represents the source of the image to be displayed

altstring

A text field that represents the image's alt text

actionstring

An optional text field that represents an action to perform when the image is clicked

Settings

#
requiredboolean

Indicates this field is required

descriptionstring

An optional friendly description

Example

#

JSON

#

A JSON input field with schema validation.

Settings

#
requiredboolean

Indicates this field is required

descriptionstring

An optional friendly description

defaultjson

The default value of the JSON field

schemaobject

A JSON Schema object that validates the expected structure of the input. Supports properties to define the expected keys and their types, and required to specify which keys must be present.

Example

#

Example usage

#

Here's an example of a partial schema, and using it in a template.

Frequently asked questions

#

It's important to note that when you define a schema for your partial, each field will have a default value.

If you don't set an explicit default value, the default will be set according to the field type. When working with string-based fields like Text, Textarea, and Markdown, the default will be an empty string ("").

In Liquid, an empty string is considered truthy, so if you want to render content in your partial based on whether an input is provided for that field, you should use a Liquid condition to check if the field is not empty.


For Boolean fields, you can simply check the truthiness of the input with an if statement:

New chat