Heading 1
This is a top-level heading, typically used for main titles and major section headers.
Heading 2
Secondary headings help organize content into clear sections and subsections.
Heading 3
Third-level headings provide further content structure and hierarchy.
"Blockquotes are perfect for highlighting important information, quotes from external sources, or emphasizing key points in your content."
Use headings to create a clear document structure that helps readers navigate your content effectively. Combine them with blockquotes to emphasize important information.
Horizontal rules help visually separate different sections of your content, creating clear breaks between topics or ideas.
1
100%
Files
'use client';
import * as React from 'react';
import { Plate, usePlateEditor } from 'platejs/react';
import { EditorKit } from '@/components/editor/editor-kit';
import { Editor, EditorContainer } from '@/components/ui/editor';
import { DEMO_VALUES } from './values/demo-values';
export default function Demo({ id }: { id: string }) {
const editor = usePlateEditor({
plugins: EditorKit,
value: DEMO_VALUES[id],
});
return (
<Plate editor={editor}>
<EditorContainer variant="demo">
<Editor />
</EditorContainer>
</Plate>
);
}
Basic block elements like headings, quotes, and code blocks.
basic-blocks-demo


Features
- Ensures a specific block type is always present at the end of the document
Manual Usage
Add Plugin
import { TrailingBlockPlugin } from 'platejs';
import { createPlateEditor } from 'platejs/react';
const editor = createPlateEditor({
plugins: [
// ...otherPlugins,
TrailingBlockPlugin,
],
});Configure Plugin
The plugin works out of the box with sensible defaults, but can be configured for specific use cases:
import { TrailingBlockPlugin } from 'platejs';
import { createPlateEditor } from 'platejs/react';
const editor = createPlateEditor({
plugins: [
// ...otherPlugins,
TrailingBlockPlugin.configure({
options: {
type: 'p', // Paragraph block
exclude: ['blockquote'], // Don't add after these types
},
}),
],
});Configuration options:
type: The block type to insert as the trailing block (defaults to paragraph)exclude: Array of block types that should not trigger trailing block insertionallow: Array of block types that are allowed (alternative to exclude)filter: Custom function to determine when to add trailing blocks
Plugins
TrailingBlockPlugin
Plugin that ensures a specific block type is always present at the end of the document or at a specified nesting level.
Key behaviors:
- Automatically adds a trailing block when the last node doesn't match the expected type
- Works through editor normalization to maintain document structure
- Supports nested structures by configuring the
leveloption - Prevents empty documents by ensuring at least one block exists
- Respects filtering options to control when trailing blocks are added
- Default:
0 - Default:
'p'(paragraph) - Default:
[](all types allowed) - Default:
[](no types excluded)
Level where the trailing node should be added, with the first level being 0.
Type of the trailing block to insert.
Filter nodes matching these types. Only these types will be considered valid trailing blocks.
Filter nodes not matching these types. These types will not trigger trailing block insertion.
Custom filter function to determine if a node should trigger trailing block insertion.