Sections
Orienting in a section file, when you want to know what the one exported value carries and how the framework finds it.
A section is one exported value. It carries what the section's content is and how the section looks, and it is also the component a page places and the platform renders.
What it is
import { compute, fact, object, Section, section, Slot, text, fill } from "@homepages/concrete";
export const Hero = section(
{
key: "hero",
label: "Hero",
slots: {
headline: text.medium({
cap: 60,
label: "Headline",
source: fill.write({ reads: [fact.property.description], brief: "What makes the property worth seeing. Write one sentence. Confident and specific." }),
}),
address: object({
label: compute(() => "Property address"),
fields: { street: text.short({ source: fact.property.address.street, label: "Street" }) },
}),
},
},
({ slot, nav }) => (
<Section id={nav.selfAnchor}>
<Slot.Text slot={slot.headline} as="h1" />
<Slot.Object slot={slot.address} as="address">
<Slot.Text slot={slot.address.street} as="span" />
</Slot.Object>
</Section>
),
);One call, two arguments. The options are the section's identity and its
slots. The render function is the markup, and it receives
bindings rather than raw values: slot.headline is typed by that slot's own
declaration, nav carries the anchors the build injected, and variant carries
the stored display case.
There is no folder to make, no second file to keep in step, and no reserved name. A section lives anywhere in the workspace, as long as a module exports it.
Why it works this way
The schema and the markup sit in one value because every consumer beyond your section needs the schema, and you need it to be next to the markup it governs. The editor reads it to know what a person may change; fill reads it to know what to produce; the publisher reads it to know what a deliverable holds. None of those ever sees your component (see the pipeline), so the declaration has to exist apart from the render — and a declaration in a separate file is a declaration that drifts from the markup beside it.
Two things follow from putting them in one call.
Identity is explicit. key is the section's identity in the platform's
catalog, namespaced under the template at publish, and it is never derived from the
export name or the file name. Renaming a variable during a refactor must not mint a
new section and orphan the content every deliverable already holds. The key is also
the in-page fragment, and the stem of the default instance id (<key>-1).
Everything derivable is derived, and nothing is declared twice. The framework
reads the composition off your pages rather than asking you to declare it a second
time — the standing bias of the framework, and the reason there is no layout
declaration, no anchor option and no group table. An editor card is an object in
slots, declared once and rendered through its own Slot.Object; slot order is
the order you wrote slots.
How it works
Discovery: placed, then matched to an export
A page places a section as JSX. The probe records the placement; discovery then enumerates the workspace's modules and collects the section values they export, and matches the two.
That matching is what makes the export rule a rule. A section the probe saw placed
but no export matches is a check error naming the file
(pages/section-not-exported) — because the
export name is what lets the build bundle that one section on its own. Two sections
declaring the same key is the other error
(workspace/duplicate-section-key).
Test files, installed dependencies and the tool configs at the workspace
root (eslint.config.mjs and its kind) are excluded from the sweep, so a section declared
inside a test is never discovered.
One section, many instances
Placing a section twice on a site is placing the same component twice:
import { section, Section } from "@homepages/concrete";
const Gallery = section({ key: "gallery", label: "Gallery", slots: {} }, () => (
<Section>
<h2>Gallery</h2>
</Section>
));
// Two placements, two deliverable-side instances, one section.
const page = (
<>
<Gallery />
<Gallery instance="gallery-2" />
</>
);Each placement is its own instance: its own content, its own edits, its own
provenance. The first takes the default id <key>-1; a second placement names its
own with instance, and that id is what ties a deliverable's content to a spot on
the site. It is explicit for the same reason key is — a derived instance id would
shift when the composition did, and take a user's edits with it.
What the render function gets
slot is one binding per declared slot, keyed by slot id. A binding carries the
slot's identity, its declaration and its value together, which is why a primitive
can read the slot's own crop settings or its cap without being handed them again,
and why the marker can never land on the wrong element. nav is the anchor of this section plus
the anchor and page maps. variant is the stored case of the section's declared
display variant, typed to the declared cases.
Nothing else reaches the render, and nothing about a deliverable can be looked up from inside it.
What it is not
Not a place for a hand-written props type. The bindings are typed from the
slots you declared. A parallel type written beside them is exactly the drift that
deriving removes.
Not a config file for the section. A schema entry is a contract with the platform, so it earns its place only when a consumer beyond your own markup has to read it. A number only your render uses is a module constant in the same file, where a reader sees it beside the markup it governs.
Not a folder convention. One section per file, several per file, or a section in the page file above the page that places it — all legal. Organize the workspace the way you would organize any React app.
Where next
- Slots — the only thing a section declares as content.
- The marker contract — what the markup owes the
editor, and why an object's fields render inside its
Slot.Object. - Add a display variant — the one
section option the render reads back, on
variant. section— its options and its bindings, member by member.concrete check— what runs discovery and the probe.
