Pages built in Build Studio are plain HTML until the runtime attaches. It scans for data-* attributes, wires them up, and keeps them in sync as data changes.
Video tutorials for this topic
No build step and no framework. You can hand-write these attributes into a page, and the property panel writes the same ones when you configure an element visually.
The full attribute set
| Attribute | Purpose |
|---|---|
data-bind | Set textContent from a path or expression |
data-bind-html | Set sanitized innerHTML |
data-bind-attr-<name> | Set an HTML attribute — data-bind-attr-src="data.image" |
data-bind-class | Set className |
data-bind-style-<prop> | Set one CSS property — camelCase, e.g. data-bind-style-backgroundImage |
data-show / data-hide | Conditional visibility |
data-format | Format a bound value |
data-format-opt-<name> | An option for that format |
data-source | Fetch data and set a context for children |
data-source-payload | Arguments for the source call |
data-loop | Repeat over an array already in state or context — cart.items — with no fetch |
data-bind-each | Marks the child that is repeated per array item |
data-action | Run a call on an event |
data-payload | Arguments for the action |
data-trigger | Which event fires it |
data-confirm | Ask before running |
data-on-success | Effect chain after success |
data-on-error | Effect chain after failure |
Binding values
<span data-bind="cart.count"></span>
<span data-bind="data.price" data-format="currency" data-format-opt-currency="EUR"></span>
<img data-bind-attr-src="data.image" data-bind-attr-alt="data.name">
<div data-bind-class="data.status"></div>
<div data-bind-style-width="data.percent + '%'"></div>An attribute binding that resolves to null, undefined or false removes the attribute rather than setting it empty.
It sets innerHTML through a sanitizer rather than assigning raw markup.
Lists
A list is two attributes working together: a container that fetches, and one child marked as the row template.
<div data-source="product.list"
data-source-payload='{"limit":12}'>
<article data-bind-each>
<img data-bind-attr-src="data.image">
<h3 data-bind="data.name"></h3>
<span data-bind="data.price" data-format="currency"></span>
</article>
</div>data-bind-each takes no value. The element carrying it is cloned once per item in the returned array, and paths inside it resolve against that row.
product.list reads limit (or pageSize), page, sort and filters as top-level keys. Nested under options they are not read, and the list comes back at its default size.
Without a data-bind-each child, data-source still sets a context — which is what you want when the source returns a single object rather than a list. A source that returns an object renders no rows even with a template: to repeat over an array the runtime already holds, use data-loop with a path instead.
<div data-loop="cart.items">
<div data-bind-each><span data-bind="name"></span> × <span data-bind="quantity"></span></div>
</div>Under data-loop the template must be a direct child. The rows re-render whenever the array at that path changes.
Where a path resolves
The runtime walks contexts in order and takes the first that has the path:
1. Row context — the current item, inside a data-bind-each template.
2. Source context — data from the nearest data-source ancestor.
3. Reactive state — appmint.state, which holds the cart mirror, the signed-in customer, and anything you set yourself.
Nothing matching renders empty rather than erroring.
Actions
<button data-action="cart.add"
data-payload='{"id":"{{sk}}","name":"{{data.name}}","unitPrice":{{data.price}}}'
data-on-success="notify:Added to cart"
data-on-error="notify-error:Could not add">
Add to cart
</button>Triggers
data-trigger overrides the default event: click, submit, change or inview.
Defaults are sensible — buttons and links fire on click, forms on submit, inputs and selects on change. inview fires when the element scrolls into view, which is how you lazy-load a section.
Payload forms
data-payload accepts these shapes:
| Form | Meaning |
|---|---|
| (omitted) | Depends on the element: a <form> sends its serialized values, an input or select its value, an element inside a data-bind-each row that row's item. Anything else sends nothing |
form | Serialize the containing form |
this | The current row item; outside a row, the element's own value |
this.<prop> | A property of the element itself — this.value, this.id — not of the row |
{"k":"v"} | A JSON object, with {{path}} interpolation inside string values |
{{path}} | The value at that path |
Anything else is treated as a path, resolved against the row, then the source, then state — not passed as a literal string. To send a fixed string, quote it as JSON: data-payload='"open"'.
Confirmation
<button data-action="order.cancel"
data-payload="{{data.number}}"
data-confirm="Cancel order {{data.number}}?">Cancel</button>The action does not run unless confirmed. The message interpolates like any other binding.
Visibility
<div data-show="customer.signedIn">Welcome back</div>
<div data-hide="cart.count">Your cart is empty</div>On the current build customer.signedIn can read true for a visitor who is not signed in: the runtime caches whatever the who-am-I call answers, and for an anonymous visitor that is a placeholder app user, not an error. Use it to tidy the page, never to hide anything private — what a visitor may see is decided by the server.
What you can reference
Anything the runtime knows about:
| Prefix | What it holds |
|---|---|
cart.* | count, total, items, isOpen — mirrored from the cart store |
customer.* | current (the signed-in customer) and signedIn |
data.* | The current row or source context |
| (anything else) | Keys you set yourself with state.set |
