Concrete
Concepts

Slots

Deciding what a section exposes, when you are choosing between a slot and a constant in your own markup.

A section's slots are a list of slots, and nothing else. A slot is content that reaches the page per deliverable and that a user can open the editor and change. Everything else a section renders is fixed at author time: markup your section owns, invisible to fill and to the editor.

What it is

A slot is a type crossed with a source. The builder picks the type; its one source picks where the value comes from. A value chosen out of a set names that set once more: a select, a row or a media slot in from.

import { compute, fact, fill, image, list, number, object, row, text } from "@homepages/concrete";

// Baked from a part of the address, which is read-only: the address is stored whole.
const street = text.short({ source: fact.property.address.street, label: "Street" });

// Baked from a stored fact, so an edit can update the property everywhere.
const unit = row({ label: "Unit", from: fact.property.units, locked: true });
const beds = number({ source: unit.beds, label: "Bedrooms" });

// Produced by the model: one pick out of the property's photos. Its `from` is
// what the user may replace it with.
const hero_image = image({
  label: "Hero image",
  from: fact.property.property_media,
  source: fill.pick({ brief: "The striking exterior." }),
});

// A list: its source decides which items it holds — here, items the model writes.
const features = list({
  label: "Features",
  min: 3,
  max: 8,
  source: fill.write({
    reads: [fact.property.description],
    brief: "The features this home really has, each a short noun phrase.",
  }),
  item: text.short({ cap: 80 }),
});

// A table's rows, every one and live; each item an object reading its own row.
const units = list({
  label: "Units",
  source: fact.property.units,
  item: (el) => {
    const unit = row({ label: "Unit", from: fact.property.units, source: el });
    const name = text.medium({ label: "Unit name", cap: 40, source: unit.label });
    return object({
      label: name,
      fields: { unit, name, beds: number({ label: "Beds", source: unit.beds }) },
    });
  },
});

// An object: fields that belong together, here reading one row of a table.
const agent = row({ label: "Agent", from: fact.property.contacts });
const listing_agent = object({
  label: compute(() => "Listing agent"),
  fields: {
    agent,
    phone: text.short({ label: "Phone", source: agent.phone }),
  },
});

There are thirteen value builders — text, number, select, url, date, email, phone, address, image, video, tour, document and poi — and the one you call is the one whose options exist. A crop option on a text slot is a compile error rather than a check-time one, because text.medium has no such option to pass. Three more shape them: a list holds many, an object groups fields that belong together, and a row holds one element of a list — the only way to read that element's members.

Why it works this way

The platform reads a section's slots without ever running the section's code — fill never calls your component, and neither does the editor's sidebar. Both act on what the declaration says, not on what your markup happens to do (see the pipeline). For that to work, the editable surface has to be derived from the declaration and never inferred from the rendered page.

Two consequences follow, and they are consequences rather than rules:

  • Content the slots never declares cannot be edited, however obviously editable it looks in the markup.
  • A slot declared but never rendered is a defect the framework reports (render/missing-slot-marker), not a silent no-op.

The deeper reason the kinds are a closed set is that two consumers each have to understand every kind that exists: the editor has to present it for a person to change, and fill has to produce a value for it. A kind either one met and did not recognise would simply stop working for that piece of content. So the framework ships the set rather than a way to invent one — and the same closure runs one level down, to sourcing: a slot names a catalog fact or a value your own section computes, both from a vocabulary the framework owns, which turns a typo in a binding into an error where you wrote it instead of a value that silently never fills.

How it works

Type crossed with source

Every slot answers the same two questions — what kind of value it holds, and where that value comes from — and the second has exactly one answer, its source.

  • A fact, a compute() or a slot ref — the value is baked from a fact, derived by a compute() over the fact graph and other slots, or MIRRORED from another slot, whose value it then holds. No model runs, and the link stays live.
  • A fill — fill.write, fill.pick or fill.find: the value is produced once by an AI fill, and is the user's after that. The verb says what the model does; the slot's type says what kind of value it does it to.

A slot names one source: a value is baked or generated, and "both" has no meaning. An address is never written: its parts and pin must agree, so its source admits only fill.find, which looks the address up. A url, date, email or phone takes a fill.write held to its form: a value that is not a link, a day, an email address or a dialable number is retried, then reported as a failed fill rather than stored. A number takes a fill.write only for an estimate the user confirms; a figure the platform holds is a fact, and is bound.

A media slot — image, video, tour, document — answers one more question: what the user picks a replacement from. A slot bound to a fact holds what its fact holds. Every other one names in from the property's media list it picks out of — fact.property.property_media for what shows the property, fact.property.floor_plans for its plans, fact.property.uploads for everything it holds — and its candidates are that list's assets of its kind. The picker offers exactly those candidates. Without from the slot owns its asset: the user uploads or pastes one into it, and nothing picks it. concrete check refuses a from that names no media list, or one on a bound slot (contract/sources).

from is the set, source is the origin

One word names a chosen value's candidates, and one names where a value comes from.

  • from is the candidate set of a select (its keys), a row (its table, which is also the row's type) and the four media kinds (a media list of the property, its assets of the slot's kind). Nothing else names a set — not on text, number, date, url, email, phone, address, poi, object or list.
  • source is an origin — a fact, the element of an enclosing list, a compute(), a slot ref or a fill — and never a set. It supplies a value of the shape the builder already declares, and concrete check holds it to that shape.
  • A pick chooses from its holder's candidates. Who picks is the only variable: with no source, the user picks in the editor; with source: fill.pick({ brief }), the model does, out of the same set, so what the model may choose and what the user may choose cannot drift. A pick names no set of its own; the brief and reads say what to prefer.

A row reads all three ways: from alone holds the table's first row, re-pickable by the user; from with source: el holds the enclosing list's element; from with source: fill.pick({ brief }) holds the model's pick out of the table.

A list is sourced, picked or written

A list's source decides which elements it holds and in what order, and its item decides what each item is made of. Every list is one of four kinds:

KindDeclared byItemMembership and order
Sourcedsource: a table, a list slot, a list-valued member or a compute()a function of the element, or absentthe source's — a table's are written back
Model-pickedsource: fill.pick({ brief })a plain declaration holding one candidate setthe model's pick, in the order its answer gives: best first, or the brief's
User-pickedno source; the item holds a candidate setas model-pickedthe user's picks, in the user's order
Writtensource: fill.write(…), or no source and no candidate seta plain declarationthe model's, or the user's by hand

A sourced list's source is any list: a fact table (fact.property.units — every row, live, so adding or removing an item edits the table), another list slot, a list-valued member of a row, or a compute(). The property's media lists are none of these: fact.property.uploads, fact.property.property_media and fact.property.floor_plans are read, never bound, and a list of the property's media is picked out of the one its item names as its from. Its item is a function of the element that returns the item — a value slot reading the element whole, or an object() of fields — and with no item, the items are the elements themselves.

A picked list's element is supplied by the pick, so its item is never a function: the item is a plain declaration whose candidate set holds the chosen value — the item itself (item: image({ from: fact.property.property_media })), or the one field of an object item that holds a candidate set and no source, a const the object's other fields read. The candidate set sits on the item, never on the list, so a value and a list item are declared the same way. A picked list whose item is a bare row({ from }) is a selection of that table's rows.

A member of a row — a unit's bedrooms, an agent's phone — is read through a row(), and only through one: row({ label, from: fact.property.contacts }) holds the table's first row, which the user may re-pick from the bar of the object card holding it, and row({ label, from: fact.property.units, source: el }) inside an item holds that item's own element. A reader's source: is then the member (agent.phone). A row at the section's top level, or among a top-level object's fields, is read by any slot of the section — its card's own fields and the slots outside the card alike; a row inside a list's item is read only within that item.

An address() offers its parts the same way, in the same scope: a reader's source: is the part (place.city, place.postal). An address holds one place whose parts and pin must agree, so a part is never edited alone: every one is read-only (where an edit goes).

cap is a budget, not a fence

On a text slot, cap is the character budget the editor shows and the generator is asked to write to. Nothing rejects a stored value for coming back long, and nothing re-measures one later. You are aiming the generator, not fencing the result — so a section has to render acceptably across a range of plausible lengths.

Emptiness is a branch you own

Whether a property has a value for a given source is not something you can guarantee: the input material varies, and nothing forces every fact to be present. A slot with no value renders its marked empty branch — the primitive still emits the marker, so the editor can still select the slot and a person can still fill it by hand. What that branch looks like is your markup.

A section that should not appear at all when the property cannot support it says so through its display visibility, seeded before fill runs. That is a decision you make at authoring time, because the platform cannot make it up on the property's behalf.

An object is the one card

Several slots become one editor card by being the fields of one object(), and that is the only way they do: the same builder makes a top-level card (an address, a contact's name and phone) and a list's item, and both render through one Slot.Object with each field inside it. An object holds no value of its own — its value is its fields' — and declares what belongs together, not where a card sits. There is no group table and no layout in the declaration. Slot order in the editor is the order you wrote slots — deliberately not the rendered DOM order, since grids reorder visually and a slot can render in two places or in one variant only.

What it is not

Not a per-placement knob. The declaration is content, not a rendering choice. A rendering choice nothing outside the section reads is a constant in the section's own code; a choice between sets of slots, which the user switches, is a display variant.

Not styling. A select value names which case was chosen, not how that case looks. The imagery and prose for a pick is markup your section owns.

Not a place for data fetching. By the time your render runs, a slot's value has arrived on its binding. Nothing about how it was produced belongs in the markup.

Where next

On this page