Overview
The Yoopta Editor is the main component that orchestrates all plugins, marks, and UI components. You create an editor instance withcreateYooptaEditor() (passing plugins and optional marks/value there), then render <YooptaEditor editor={editor} onChange={...} />. Content is stored on the editor instance and synced via onChange.
Creating an Editor Instance
UsecreateYooptaEditor() with an options object. Plugins are required; marks and initial value are optional:
Plugins and marks are configured at creation time, not on the
<YooptaEditor> component. Value is managed via the editor instance and onChange.YooptaEditor Component Props
The<YooptaEditor> component accepts:
Required
The editor instance from
createYooptaEditor()Optional
Called when content changes. Use it to sync
value to your state (e.g. for saving or controlled usage).Called when the selection path changes (current block, selected blocks, etc.).
Whether to focus the editor on mount.
Global placeholder text shown when the editor has a single empty block. If a plugin defines its own element-level placeholder, the element-level placeholder takes priority in multi-block editors. See Placeholders for details.
CSS class for the editor wrapper.
Inline styles for the editor wrapper.
UI components to render inside the editor (e.g. toolbar, slash menu, block actions).
Custom wrapper for each block (e.g. for drag-and-drop).
Basic Example
Placeholders
Yoopta supports placeholders at two levels that work together:- Editor-level — a global fallback placeholder passed to
<YooptaEditor placeholder="..." /> - Element-level — per-plugin placeholders set via
.extend()on each element type
How resolution works
When a block is focused and its element is empty, the editor resolves which placeholder to display:- Check the focused element’s type (e.g.
heading-one,step-list-item-heading) - If that element has a
placeholderdefined — use it - Otherwise, fall back to the editor-level
placeholderprop
Editor-level placeholder
Element-level placeholder
Set placeholders per element type using.extend():
Nested plugins
For plugins with multiple nested elements (e.g. Steps, Accordion), you can set a different placeholder for each element:Styling
Placeholders are rendered via the.yoopta-placeholder CSS class and data-placeholder attribute. If you use a Yoopta theme (e.g. @yoopta/themes-shadcn), placeholder styles are included. For headless usage, add your own styles:
Content Value Structure
Content is a record of block ID → block data. Type names use PascalCase for block types (e.g.Paragraph), and kebab-case for element types inside value.
Example
onChange Options
TheonChange callback receives the new content and an options object:
options.operations to know what changed (insert, update, delete, move, etc.) without diffing the whole value.
Styling the Editor
Using className
Using style
Multiple Editors
Each editor instance is independent. Create separate instances withcreateYooptaEditor() and separate state for each:
Next Steps
Plugins
Learn about plugins and how to use them
Editor API
createYooptaEditor options and YooEditor instance API
Events
Handle editor events (on, off, emit)

