Block editor

Content comes first. There is no toolbar and no activity bar. Type / on an empty line to pick a block, hover a block for its handle, and select text to format it.

Installation

This editor is components/editor/editor-block.tsx. It is installed with @intentui/editor, next to editor.tsx. Render DemoBlockEditor, or copy the file and rename it.

npx shadcn@latest add @intentui/editor
app/page.tsx
import { DemoBlockEditor } from "@/components/editor/editor-block"

export default function Page() {
  return <DemoBlockEditor />
}

How you use it

You want toDo this
Add or change a blockType / and pick from the menu, or hover a block and click the plus button on its handle.
Move a blockDrag it by its handle. See Draggable block.
Format textSelect text. The floating toolbar offers bold, italic, underline, strikethrough and a link.
Write MarkdownType it. # , - , > , ` and the other shortcuts convert as you type, see Markdown shortcuts.

The placeholder reads "Type '/' for commands" while the editor is empty.

The slash menu

The menu uses the detailed variant of ComponentPicker: three sections, and an icon tile, a label and a description for every item. Typing after the slash filters the list by label and keyword.

SectionItems
Basic blocksParagraph, headings 1 to 3, bulleted list, numbered list, check list, quote, divider
MediaImage
AdvancedTable, code block, 1, 2 and 3 columns
components/editor/editor-block.tsx
<ComponentPicker variant="detailed">
  <ParagraphPickerPlugin />
  <HeadingPickerPlugin />
  <BulletedListPickerPlugin />
  <NumberedListPickerPlugin />
  <CheckListPickerPlugin />
  <QuotePickerPlugin />
  <DividerPickerPlugin />
  <ImagePickerPlugin />
  <TablePickerPlugin />
  <CodePickerPlugin />
  <ColumnsPickerPlugin />
</ComponentPicker>

Items appear in the order of the plugins, so move a line to move an item and delete a line to remove it. See Slash menu for the group and description fields and how to add your own item.

What's included

Extensions

ExtensionBehavior
RichTextExtensionRich text editing. Required.
HistoryExtensionUndo and redo.
TabIndentationExtensionIndent and outdent with Tab.
ListExtension, CheckListExtensionBulleted, numbered and check lists.
LinkExtension, AutoLinkExtensionLinks and automatic link detection.
CodeExtensionCode blocks with syntax highlighting.
LayoutExtensionColumns.
TableExtensionTables.
HorizontalRuleExtensionDividers.
ImageExtension, DragDropPasteExtensionImages, including drag, drop and paste.
ShortcutsExtensionKeyboard shortcuts, see Shortcuts.
FormatStateExtensionLets the floating toolbar show which formats are active.
ClipboardDOMImportExtensionCleaner pasting of HTML.

UI

PieceWhat it does
ContentEditable with variant="draggable"The writing area, with room on the left for the drag handle.
DraggableBlockPluginThe handle with a plus button and drag and drop.
FloatingToolbarPluginThe toolbar next to a selection, holding TextFormatToolbarPlugin formats="basic" and LinkToolbarPlugin.
LinkEditorPluginEdits a link. The link button does nothing without it.
TableHoverActionsPluginAdd and remove rows and columns on hover.
ComponentPickerThe slash menu.

Compared with the full editor

Left outWhere it was
The toolbarAbove the content, with fonts, colors, alignment and indent controls
The activity barBelow the content, with counts, speech to text and the shortcuts dialog
Emoji, mentions, hashtags and special textPickers and extensions
Autocomplete, tab focus and speech to textExtensions
The context menuContent area

To bring something back, copy its extension and its plugin from editor.tsx. The other patterns list which pieces belong together.