Bindings, loops and conditions reference
Bindings resolve structured values into authored HTML. Marker attributes describe the source contract and are stripped from the rendered Design/public projection. The examples below use a fictional Articles collection and require matching real collection/field keys in your fixture.
Before you start
Section titled “Before you start”- Create known entries with a live state and supply the correct ResolveContext. Test missing values and diagnostics as well as the happy path.
-
Use supported target bindings:
<h2 data-bind-text="articles.title">Fallback title</h2><img data-bind-src="articles.cover" data-bind-alt="articles.title" alt="Fallback"><time data-bind-text="articles.date | date:long"data-bind-datetime="articles.date">Date</time>Text replaces element content with the resolved value; src/href/alt target their corresponding attributes. Datetime requires a time element.
-
Repeat the first eligible child element of a loop:
<section data-loop="articles"><article><h2 data-bind-text="articles.title">Title</h2></article><p data-loop-empty>No articles yet.</p></section>The empty-state child is reserved for zero results. The loop uses a default limit of 50 and a maximum of 500 in the current resolver.
-
Use supported data-loop-filter, data-loop-order and data-loop-paginate controls according to their parser contracts. Only one loop may paginate. A condition on the repeated template itself is ignored with a diagnostic; filter the loop so counts and empty states remain meaningful.
-
Use
data-iffor supported conditional visibility outside that repeated-item restriction. Invalid conditions retain content with diagnostics rather than creating an authorization boundary. Never rely on hidden markup or crawler rules to protect private data.
Component properties and item scope
Section titled “Component properties and item scope”A shared section definition declares scalar types/defaults on its root. data-section-prop-text, data-section-prop-href, data-section-prop-src and data-section-prop-alt connect controls to a property. Use strukt.section.<name> as dynamic data inside that definition, and strukt.item.<field> inside its repeater item:
<section data-section-type-heading="text" data-section-default-heading="Products"> <h2 data-section-prop-text="heading">Products</h2> <p data-bind-text="strukt.section.heading">Heading fallback</p> <ul data-section-repeat="items" data-section-item-type-title="text"> <li data-bind-text="strukt.item.title">Item fallback</li> <li data-loop-empty>No products.</li> </ul></section>On an instance, data-section-bind-<name> takes a plain compatible field reference; it does not accept a filter pipe or select a record. Format a value on its consuming data-bind-* control when supported. data-section-value-<name> stores the local literal/fallback. A list input is an inert direct-child template containing its source and field mappings. Replace this fictional UUID with a real section ID, and render the scalar binding inside a Products record scope:
<div data-strukt-section="00000000-0000-4000-8000-000000000001" data-section-bind-heading="products.title" data-section-value-heading="Featured products"> <template data-section-list="items" data-section-list-bind="products.$records" data-section-list-limit="20" data-section-list-map-title="title"></template></div>Every declared repeater item field needs a compatible mapping. collection.$records accepts a limit of 1–200 (default 20); collection.list-key reads a mapped list from the current record, while strukt.section.list-name forwards a parent component list. Repeater item fields are flat scalars; raw object/array values are not scalar properties.
Scalar types are text, number, boolean, url, media, date and datetime. Resolution prefers a valid dynamic value, then an instance literal, then an explicit definition default, then the authored control fallback. Zero, false and empty text remain values. For an unavailable list, data-section-list-fallback="rows" selects locally authored rows; otherwise definition rows apply. A valid empty list never activates fallback rows. Authoring markers and inert list-input templates do not appear in the resolved public output.
See component properties for authoring controls and the API tutorial for a complete typed definition.
Check the result
Section titled “Check the result”- Resolved HTML contains the intended public values and no authoring markers, and diagnostics identify invalid keys or targets.
Troubleshooting
Section titled “Troubleshooting”If fallback appears, inspect source scope, published snapshot and field compatibility. Do not infer that an invalid binding is an empty real value or alter a rendered copy instead of its owning template.
Related guides
Section titled “Related guides”Applies to Strukt 0a2349798283 · 2026-11-02