BlocksFeature embeds reusable Block configurations in rich text. Blocks support the same fields, hooks, validation, access control, and conditional logic as a Blocks field, but their data is stored inside the rich text JSON.
Basic setup
Define blocks separately so their schemas can be shared with regular Blocks fields:BlocksFeature options
Blocks and inline blocks
Regular blocks are block-level elements. They occupy their own line and work well for call-to-action sections, galleries, code, and embedded content. Inline blocks flow within text. Use them for mentions, badges, variables, icons, and footnote references.editor. This keeps its feature set deliberate and avoids recursively inheriting the root editor’s block configuration.
Stored data
Each block node contains afields object with the block’s field values. FrogBot generates id; blockType identifies the configured block; and editors can set the optional blockName label.
"type": "inlineBlock".
Custom block components
Setadmin.components.Block to replace a block’s editor UI. Component paths resolve from the configured import-map base directory and can include a named export. See Component paths.
Client block components
Client components can compose the standard editor controls.BlockCollapsible provides the field drawer and default controls; disable its remove button when rendering BlockRemoveButton yourself.
BlockCollapsible and render a completely custom layout while retaining the edit and remove controls.
Server block components
Server component props carry aFrogBotRequest. Use req.frogbot for server operations:
Inline block components
Inline block primitives provide the default container, label, edit button, and remove button:Label components
Setadmin.components.Label to display block values in the block header.
admin.components.Label. See custom block components for the complete block configuration shape.
Component prop types
Import all component prop types from the package root:
The editor renders block and label components as the custom component of an internal UI field that sits alongside the block’s fields. Their
field and path props describe that internal field, not the block. Read block values with useFormFields in a Client Component, or from data in a Server Component.
The four client types share these props:
The four server types share these props:
Rendering blocks
Frontend converters map each block slug to its rendered output:- JSX converters for React and Next.js
- HTML converters for HTML output
- Markdown converters for Markdown output
CodeBlock
CodeBlock is a ready-made block with syntax highlighting, language selection, and optional TypeScript diagnostics. Import it from the package root:
CodeBlock options
TypeScript support
fetchTypes downloads declaration files into the editor’s virtual file system. Every imported declaration dependency must also be loaded. Pin versions so a later package release cannot change the editor environment unexpectedly.
This example loads React’s declarations plus its csstype dependency:
dist/index.d.ts; it does not publish a single bundled declaration file. To offer FrogBot APIs in the editor, pin and load that declaration plus every declaration it imports, or publish a self-contained declaration bundle from your application. Do not point fetchTypes at an unverified index.bundled.d.ts URL.