Skip to main content

What a composition's ui tree holds

Every Template and Section is saved as a JSON tree in its ui field. This topic lists every node you can put in that tree, and the JSON each one takes. You need it when you build a layout for the Studio API, or when you read one that Studio saved.

The examples use the Blog project: the Blog post content type, the Post hero and Related posts Sections, and the entry AI 101.

The tree in one minute​

  • The tree is made of nodes. The root node has the type page, for a Section too.
  • A node has a type, props and slots. The type is a built-in node type, or the string you registered a component under.
  • A prop gets its value from a binding. See Bind data to a node for the six sources.
  • A slot holds child nodes.
  • A Repeater shows its children once for each item in a list. A Condition Block shows its children only when a condition passes.
  • A Template places a Section with a section-composition node. A Section can leave a Section Slot for the Template to fill.

Find the node you need​

You want toUseDetails
Show a heading, a paragraph, an image or a buttonA built-in node such as header, text, image or buttonBuilt-in node types
Show your own componentA node whose type is the string you registeredRegistered component node
Show one fieldA prop with a bindingBind one field to a prop
Repeat a card for each itemrepeaterRepeater node
Show a node only when a condition holdscondition-blockCondition Block node
Show a different card for each reference or block typerepeater with one condition-block for each typeReference fields and Modular blocks fields
Leave a gap in a Section for a Template to fillsection-slotSection Slot node
Place a Section in a Templatesection-compositionBinding override on a placed section
Let a Template change one value inside a SectionsectionExposedProps on the Section's root nodeExposed section props

Read in this order​

PageRead it when
Nodes, props and slotsYou write or read any node. It covers the keys, slots and the node and prop types.
Bind data to a nodeA prop should show a field, a fixed value, a pinned entry, a query or data your app passes in.
Repeaters and condition blocksA layout shows a list, or shows something only when a condition holds.
Section slots, overrides and exposed propsA Template places a Section, fills a slot in it, or changes a value inside it.
Section and template JSON examplesYou want a whole tree to copy and adapt.

To send a layout to the API, see Create a section and a template with the API.

Report a problem with this page