{ id, type, props }; the page template looks the type up in the registry and hands the renderer the props. The renderer emits HTML with anchors on it, and those anchors are what make it editable. There is no field schema to write: the fields are whatever the renderer anchors.
1. Build the renderer
src/components/<area>/Callout.astro. Group by where it lives in the site: home/, about/, careers/, global/.
Two rules that matter in edit mode:
- Render the stored value as it is. No truncating, no reformatting. The editor compares what is on screen with what is stored.
- Anchor the element that holds the text, not a parent. That exact element becomes editable.
2. Register it
src/lib/components.ts maps the stored type to the renderer. The key is exactly what the row will store.
3. Put it on a page
Two ways, and a page can use both. Fixed. Always there, editors cannot remove it. One line under the page’ssections:
props are what the section holds until someone edits it.
Addable. Editors add it from the tab on the right, and can reorder and remove it. An entry in the page’s palette:
starter is what a fresh block stores. Text fields start as "". A media slot is the pair image and imageVideo, both "".
4. Run dev
A fixed section renders on the next dev start, empty until someone types. A palette entry appears on the tab in Edit mode. Either way, click a field in/admin and it is editable.
If the component has a list
A row of logos, cards or team members inside the component is an array. Its items are editable with anchors. Adding, reordering and removing need one schema entry. See Make a list addable.If it renders on two pages
A value with one home shown in two places, such as a stat on the home page that belongs to a case study, is anchored withstageRef instead of stagePath. The editor saves to the one row. See Shared content.
Next steps
Components
The full renderer contract.
Edit anchors
Every attribute and helper.