| Import | Use | Optional peer |
|---|---|---|
platejs | Headless editor creation, Plate plugins, editor APIs, core types, and utilities. | None |
platejs/react | React editor creation, components, hooks, stores, and React plugins. | @tanstack/react-virtual, React, and React DOM |
platejs/static | Static editor creation, HTML rendering, and static node renderers. | React and React DOM |
platejs/dom, platejs/history, platejs/hyperscript | DOM and clipboard integration, history persistence, and JSX fixtures. | None |
@platejs/test | Node-safe editor fixtures and environment-specific test harnesses. | React and Testing Library for /react; Playwright for /playwright |
platejs/pagination | Pagination geometry and measurement. | @chenglou/pretext |
platejs/pagination/react | React hooks for pagination geometry. | @chenglou/pretext, @tanstack/react-virtual, React, and React DOM |
platejs/diff | Document diff helpers. | diff-match-patch-ts |
Use platejs for non-React editor work and shared types.
import { createEditor } from 'platejs';
export const editor = createEditor({
initialValue: [
{
type: 'paragraph',
children: [{ text: 'Headless editor.' }],
},
],
});import { createEditor } from 'platejs';
export const editor = createEditor({
initialValue: [
{
type: 'paragraph',
children: [{ text: 'Headless editor.' }],
},
],
});Use platejs/react for app editors.
import { EditorRoot, EditorContent, useCreateEditor } from 'platejs/react';
export function BasicEditor() {
const editor = useCreateEditor({
initialValue: [
{
type: 'paragraph',
children: [{ text: 'React editor.' }],
},
],
});
return (
<EditorRoot editor={editor}>
<EditorContent />
</EditorRoot>
);
}import { EditorRoot, EditorContent, useCreateEditor } from 'platejs/react';
export function BasicEditor() {
const editor = useCreateEditor({
initialValue: [
{
type: 'paragraph',
children: [{ text: 'React editor.' }],
},
],
});
return (
<EditorRoot editor={editor}>
<EditorContent />
</EditorRoot>
);
}Use platejs/static for rendering or serialization paths that do not mount an editable React editor.
import { createStaticEditor } from 'platejs/static';
export const staticEditor = createStaticEditor({
initialValue: [
{
type: 'paragraph',
children: [{ text: 'Static editor.' }],
},
],
});import { createStaticEditor } from 'platejs/static';
export const staticEditor = createStaticEditor({
initialValue: [
{
type: 'paragraph',
children: [{ text: 'Static editor.' }],
},
],
});| Page | Covers |
|---|---|
| Plate Core | Editor creation, React runtime, plugins, stores, and render primitives. |
| Plate Utilities | Plate-owned identities and utility plugins. |
| React Utils | React utility hooks and helpers re-exported through platejs/react. |
| Plate Components | EditorRoot, EditorContent, EditorPreview, and component primitives. |
| Plate Editor | Runtime editor type, core APIs, transforms, DOM state, and metadata. |