# blocks > **Ready sections:** the plugin ships fifteen standard blocks (hero, FAQ, gallery, contact…) and page > templates — [block-library.md](./block-library.md). Use a library block or a variant of one first; this page > describes the engine and the field builders they are made of, which your own blocks use too. `RenderBlocks` — a generic, server-side block rendering engine. The plugin does not know your blocks: it iterates over the data, maps `blockType` → component through a registry (prop), handles nesting and per-block extensions. You define the blocks (schema + components) in your project. ## Config No options in payload.config — you define blocks in your collections (a `blocks` type field). The plugin provides only the rendering engine. ## ⚠️ Do NOT write your own block renderer (switch) **The block renderer is `RenderBlocks` from the plugin — NEVER your own `switch`/`if`.** Common mistake: the project writes its own `BlockRenderer` with `switch (block.blockType)` and 20 cases. That breaks A0 — the plugin has the engine, the project provides only the component MAP. ```tsx // WRONG — own switch in the project (verbose, no enhanceProps, grows linearly) switch (block.blockType) { case 'hero': return case 'faq': return // ...20 cases } // RIGHT — map + RenderBlocks (engine from the plugin) const registry = { hero: Hero, faq: FAQ, /* ... */ } ``` Why RenderBlocks, not a switch: enhanceProps (nav anchors, etc.), guards, nesting support, consistency across projects. A switch has none of this and grows with every block. The map is flat and declarative. ## Front — RenderBlocks Import from `@intecion/ipal-kit/rsc` (it is a server component): ```tsx import { RenderBlocks } from '@intecion/ipal-kit/rsc' // Your registry: blockType → component (the components are yours) import { Hero } from '@/blocks/Hero' import { FormBlock } from '@/blocks/FormBlock' const registry = { hero: Hero, formBlock: FormBlock } export default async function Page() { const page = await payload.findByID({ collection: 'pages', id }) return } ``` - unknown `blockType` → skipped (null), does not crash - `blocks` empty / `null` → `null` - nested blocks: the parent component renders `` itself and **imports the registry itself** — the engine does NOT pass the map in props (functions do not cross the server→client boundary in RSC) ## enhanceProps — per-block logic without the plugin knowing When a block needs data from other blocks (e.g. a nav collecting anchors from sections), pass `enhanceProps`. The plugin calls it without knowing your blocks: ```tsx // arguments: { block, allBlocks, index } const enhanceProps = ({ block, allBlocks }) => { if (block.blockType !== 'sectionNav') return {} const sections = allBlocks .filter((b) => b.blockType === 'anchoredSection') .map((b) => ({ anchor: b.anchor, label: b.navLabel })) return { _sections: sections } } ``` ## Shared section fields — `buildSectionHeaderField`, `buildSectionSettingsField` ```ts import { buildLinksField, buildSectionHeaderField, buildSectionSettingsField } from '@intecion/ipal-kit' fields: [ buildSectionHeaderField(), // `header` group: eyebrow, heading, intro (localized) — type SectionHeaderData …block fields…, buildLinksField(), buildSectionSettingsField(), // `settings` sidebar: anchor, background — type SectionSettings ] ``` Default: `header` (interface `SectionHeaderData`), `settings` in the sidebar (interface `SectionSettings`) with `anchor` and `background` (`default` / `muted` / `inverted`, the first value by default). Everything can be changed: `buildSectionSettingsField({ backgrounds: [{ label: 'Brand', value: 'brand' }], anchor: false, fields: [{ name: 'spacing', … }] })`, `backgrounds: false` (no background choice), `buildSectionHeaderField({ name, fields, interfaceName })`. The project maps the background values to its `
` classes. The data shape matches the former `src/fields/sectionHeader.ts` / `sectionSettings.ts` from section-code.md — swapping the import needs no migration. ## Block component Each component gets the block data as props (plus whatever `enhanceProps` returns; in `createPageRoute` also `locale`, `isFirst`, `firstImage` and `blockProps` — frontend.md; `blockPosition` computes the two for your own `enhanceProps`). Spacing/layout are yours — the engine does not wrap blocks in any markup. ```tsx export function Hero(props) { return
{/* ... */}
} ``` Types: `BlockComponentMap`, `BlockData`, `EnhanceProps`, `RenderBlocksProps` (`/rsc`), `SectionHeaderFieldOptions`, `SectionSettingsFieldOptions` (root). ## Turn off, override, extend - The module has no options in `ipalKit()` — it adds nothing to the schema; you either use `RenderBlocks` or not. - The project keeps the component map and the block schemas; add per-block logic through `enhanceProps`. - `buildSectionHeaderField` / `buildSectionSettingsField`: `name`, `fields` (extra fields), `interfaceName`, `anchor: false`, `backgrounds: […] | false`. - The engine does not wrap blocks in markup and has no wrapper option — the project component does the wrapping.