repeater
A marker tag, not a sidebar control. Emit `<repeater />` from your React component and the editor swaps it for a real WP InnerBlocks UI — Add button, drag-to-reorder, child-block scoping. Most blocks don't need a `type: "repeater"` entry in their fields config.
Stored value
n/a — repeater behaviour comes from the marker tag your component emits, not from a saved field value. Child data lives in `innerBlocks`.
Supports
- Editor-only InnerBlocks UI swap via a marker tag
- Allowed-child-block whitelist via `allowedblocks`
- Custom add-button label and optional template seed
Config options
allowedblocksstring (JSON array)- JSON-stringified array of allowed child block names. Set on the marker tag, not in `block.fields.json`.
addbuttonlabelstring- Label for the Add button. Set on the marker tag.
templatestring (JSON array)- Optional. JSON of initial child blocks to seed the repeater with. Set on the marker tag.
Example
// Emit this from your React component:
<repeater
allowedblocks={JSON.stringify(['gcb/accordion-item'])}
addbuttonlabel="Add item"
/>
Gotchas
Notes
The marker tag
Emit this from your React component:
export default function Accordion({ attributes, innerBlocks = [] }) {
return (
<div className="accordion">
{/* On the public site: render the inner blocks normally. */}
{innerBlocks.length > 0
? innerBlocks.map((child) => /* dispatch via your block registry */ null)
: (
/* Marker — only meaningful in the editor preview. */
/* eslint-disable-next-line react/no-unknown-property */
<repeater
allowedblocks={JSON.stringify(['gcb/accordion-item'])}
addbuttonlabel="Add item"
/>
)}
</div>
);
}When to actually use repeater-type
Only when you want a block-level array attribute AS WELL as the marker. In most cases the marker alone is what you want — the child blocks ARE the data. Don't add a type: "repeater" entry to your block.fields.json just because you have a repeater marker in your component.
Look at the accordion-test block in the demo theme for the working pattern: marker in the component, no repeater entry in the field config, child block has its own block.fields.json.