The {% schema %} block holds one JSON object. It describes the section to the theme editor and to the platform, and prints nothing.
Fields#
Field |
Required |
Meaning |
|---|---|---|
|
Yes |
The section's name, unique in the theme. |
|
No |
|
|
No |
The global surface a |
|
No |
The icon shown for the section in the editor. |
|
No |
The store data the section reads. See CTX. |
|
No |
The section's settings. |
|
No |
The blocks the section accepts. |
|
No |
Ready-made versions of the section offered when a merchant adds one. |
Settings#
{ "id": "heading", "type": "text", "default": "Welcome",
"editor": { "label": "Heading", "group": "content" } }
Key |
Meaning |
|---|---|
|
Unique in the section. The template reads |
|
One of the setting types below. |
|
The value a new section starts with. |
|
|
|
For |
|
For |
|
For |
|
Show the setting only when another setting has one of the given values: |
label, group, option labels and a preset's name and category can be literal text or keys from the theme's editor translations, locales/<locale>.schema.json: fieldLabel.<label> for setting, option and field labels, fieldGroup.<group> for groups and preset categories, and sectionName.<name> for presets. A theme that ships editor translations must define every key it uses in each of those files, so the editor never shows a raw key. See Theme Locale Files.
Setting types#
Type |
Editor control |
The template reads |
|---|---|---|
|
Single-line text |
Text |
|
Multi-line text |
Text |
|
Rich text editor |
Formatted HTML, cleaned of anything unsafe |
|
Number |
Number |
|
Slider |
Number |
|
Toggle |
|
|
Drop-down |
The chosen option's |
|
Colour picker |
Hex colour |
|
One of the theme's colour schemes |
The scheme's id |
|
Image from the media library |
Image URL; use |
|
Video from the media library |
Video URL |
|
Link |
URL |
|
A group of the declared |
Object of field values |
|
Code editor |
The rendered output of the merchant's Vascula code |
|
Menu picker |
See Bound settings |
|
Search and pick one |
The picked item, or nothing if it was deleted |
|
Pick and order several |
A list of the picked items |
Blocks#
"blocks": {
"max": 8,
"default": ["slide", "slide"],
"types": [
{ "type": "slide",
"editor": { "label": "Slide" },
"settings": [
{ "id": "caption", "type": "text", "editor": { "label": "Caption" } }
] }
]
}
Field |
Meaning |
|---|---|
|
The block types this section defines. Each has a |
|
The blocks a newly added section starts with. |
|
The most blocks a merchant can add. Omit for no limit. |
|
Accept the theme's shared theme blocks. |
|
Accept blocks from installed apps. |
Presets#
A preset is a ready-made version of the section in the editor's "Add section" list.
"presets": [
{ "name": "Two testimonials", "category": "Social proof",
"settings": { "heading": "Loved by customers" },
"blocks": [ { "type": "quote" }, { "type": "quote" } ] }
]
Preset settings must be declared settings, and preset blocks must be declared block types, or theme blocks (theme:<name>) when the section accepts them.
Rules#
nameis required. Setting ids are unique in the section and in each block type.- An editable setting uses a supported type.
selectneedsoptions,objectneedsfieldswith unique keys,rangeneedsminbelowmax. visible_ifnames another setting and at least one value.- Every block type has at least one editable setting, and every type in
defaultis declared. - A block file (
kind: block) has notargetand no presets, and itsblocksmay only accept theme blocks. - Saved settings may contain only declared settings. A section with blocks always stores a
blockslist, which may be empty.