Skip to Content
For Developers<Blok /> component

<Blok /> component

The single entry point for the editor.

import { Blok, type Config, type Data } from "@useblok/core"; import "@useblok/core/styles.css"; <Blok config={config} data={initialData} onSave={handleSave} />

Blok is a client component. It wraps the rest of the editor in its providers (store, plugins, AI, versions, comments, audit, presence, permissions, publish gates) and mounts the top bar, rails, and canvas.

Props

Core

PropTypeDefaultDescription
configConfigRequired. Component library, root, categories.
dataDataempty documentInitial document. Treated as the initial state — don’t drive it as a controlled prop.
historyLimitnumber100Undo ring-buffer size.

Chrome

PropTypeDescription
titlestringShown in the top bar.
slugstringShown under the title.
previewUrlstringPreview icon in the viewport bar.
publishedUrlstringURL opened by “Open Published”.
publishedDataDataEnables the “Published JSON” menu item.
templatesUrlstringShows a “Templates” link in the top bar.

Save & publish

PropTypeDescription
onSave(data: Data) => voidFired by ⌘/Ctrl+S or the Save button.
onPublish(data: Data) => voidFired by the Publish button.
onSchedulePublish(data: Data) => voidFired by Publish → Schedule.
onUnpublish() => voidFired by Publish → Unpublish.

Plugins

PropTypeDescription
pluginsBlokPlugin[]See Plugin API.

AI

PropTypeDescription
aiProviderAiCompletionProvider | nullCompletion backend (OpenAI proxy, mock, etc).
aiActionsAiAction[]Extra actions registered outside of plugins.

Collaboration bindings

PropTypeDescription
versionsVersionsBinding | nullEnables the Versions modal.
commentsCommentsBinding | nullEnables the Comments panel.
commentAuthorCommentAuthorIdentity used when posting comments.
auditAuditBinding | nullEnables the Audit log modal.
auditActorAuditActorActor stamped on emitted audit events.
presencePresenceBinding | nullEnables the peer-presence avatars.
presenceIdentityPresenceIdentityIdentity announced to peers.

See Real-time bindings for how to build or import bindings (the @useblok/sdk package ships ready-made ones).

Access control

PropTypeDefaultDescription
role"editor" | "reviewer" | "viewer""editor"Session role. UI-side only — enforce server-side too.
publishGatesPublishGatesConfigPre-publish validation. See permissions.

Minimal

<Blok config={config} />

Common

<Blok config={config} data={initialData} title="Landing page" slug="marketing/home" previewUrl="/preview?slug=home" role={currentUser.role} onSave={handleSave} onPublish={handlePublish} />

With collaboration

import { useBlokDocument } from "@useblok/sdk"; function EditorPage() { const doc = useBlokDocument({ adapter, documentId }); return ( <Blok config={config} data={doc.initialData} versions={doc.versions} comments={doc.comments} presence={doc.presence} audit={doc.audit} commentAuthor={currentUser} onSave={doc.save} onPublish={doc.publish} /> ); }

See Real-time bindings for the full SDK flow.

Last updated on