Skip to main content
The 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:
See Blocks fields for every block configuration option.

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.
If a block contains another rich text field, configure that nested field with an explicit editor. This keeps its feature set deliberate and avoids recursively inheriting the root editor’s block configuration.

Stored data

Each block node contains a fields object with the block’s field values. FrogBot generates id; blockType identifies the configured block; and editors can set the optional blockName label.
Inline blocks use the same shape with "type": "inlineBlock".

Custom block components

Set admin.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.
You can omit BlockCollapsible and render a completely custom layout while retaining the edit and remove controls.

Server block components

Server component props carry a FrogBotRequest. Use req.frogbot for server operations:
The same client/server choice is available for regular blocks, inline blocks, and their labels.

Inline block components

Inline block primitives provide the default container, label, edit button, and remove button:
Compose only the controls you need when rendering a custom inline layout:

Label components

Set admin.components.Label to display block values in the block header.
Configure these exports under 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:

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:
FrogBot publishes normal package declarations at 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.