Skip to content
Kits

MarkdownEditor

BetaBeta — the props contract is close to final, but small breaking changes can still land.

Compose Markdown with draggable blocks, slash commands, people mentions, formatting, and application-owned image uploads.

Examples

Selection bubble menu

Replace the fixed toolbar with formatting that floats above selected text: text style, bold, italic, strikethrough, inline code, and links.

Read-only

readOnly locks the document, the toolbar, and task checkboxes while the content stays focusable and selectable.

Composition

Markdown composition

Markdown strings stay application-owned. Content includes block drag handles (Alt+ArrowUp/ArrowDown also moves blocks). Suggestions adds slash commands and accepts people with persistent profile URLs; mentions save as Markdown links. Supply onUploadImage to enable image paste and drop. Pass extensions to add TipTap extensions after the built-in Markdown set, and isUrlAllowed to change which link and image URLs stay editable (a file-based editor can accept relative links); both are read once, when the editor mounts.

  • <MarkdownEditor>
    • <MarkdownEditorToolbar />
    • <MarkdownEditorContent />
    • <MarkdownEditorSuggestions />
    • <MarkdownEditorUploads />
    </MarkdownEditor>

Selection bubble menu

Use MarkdownEditorBubbleMenu instead of, or alongside, MarkdownEditorToolbar. It appears above non-empty text selections outside code blocks and reuses the toolbar's text style, mark, and link controls; pass children to append custom controls.

  • <MarkdownEditor>
    • <MarkdownEditorContent />
    • <MarkdownEditorBubbleMenu />
    • <MarkdownEditorSuggestions />
    </MarkdownEditor>

Installation

Use this command to install the component.

Registry command
See registry manifest

Usage

Dependencies

Selection bubble menusrc/registry/sources/control-ui/markdown-editor/bubble-menu.tsxSupport
Contextsrc/registry/sources/control-ui/markdown-editor/context.tsSupport
Block drag handlesrc/registry/sources/control-ui/markdown-editor/drag-handle.tsxSupport
Drag previewsrc/registry/sources/control-ui/markdown-editor/drag-preview.tsSupport
Extensionssrc/registry/sources/control-ui/markdown-editor/extensions.tsSupport
Slash commands and mentionssrc/registry/sources/control-ui/markdown-editor/suggestions.tsxSupport
Task itemsrc/registry/sources/control-ui/markdown-editor/task-item.tsxSupport
Formatting and imagessrc/registry/sources/control-ui/markdown-editor/toolbar.tsxSupport
Uploadssrc/registry/sources/control-ui/markdown-editor/uploads.tsSupport
Use image uploadssrc/registry/sources/control-ui/markdown-editor/use-image-uploads.tsSupport
Labelsrc/registry/sources/control-ui/ui/label.tsxSupport
ButtonbuttonComponentChatComposerAttachmentchat-composer-attachmentKitCheckboxcheckboxComponentDropdownMenudropdown-menuComponentInputinputComponentLive statuslive-statusComponentPopoverpopoverComponentScroll areascroll-areaComponentTextareatextareaComponentToolbartoolbarComponentTooltiptooltipComponentTrigger Menutrigger-menuComponentTypographytypographyComponent

Raw code

Installed component source and support files

src/registry/sources/control-ui/markdown-editor.tsx

Knobs

Typed custom properties the recipe paints with. Set one on the root — style, a utility class, or a skin — and every slot inherits it.

--cui-markdown-editor-* · 12 knobsHow the cascade resolves
--cui-markdown-editor-background<color>var(--background)
--cui-markdown-editor-foreground<color>var(--foreground)
--cui-markdown-editor-border-color<color>var(--border)
--cui-markdown-editor-radius<length-percentage>var(--radius-panel)
--cui-markdown-editor-padding<length-percentage>calc(var(--spacing) * 4)
--cui-markdown-editor-gutter-size<length-percentage>var(--control-h-xs)
--cui-markdown-editor-min-height<length-percentage>calc(var(--spacing) * 32)
--cui-markdown-editor-max-height<length-percentage>60dvh
--cui-markdown-editor-gap<length-percentage>calc(var(--spacing) * 3)
--cui-markdown-editor-muted-foreground<color>var(--muted-foreground)
--cui-markdown-editor-code-background<color>var(--muted)
--cui-markdown-editor-border-width<length>var(--control-rim-width)
--cui-label-* · 1 knobsHow the cascade resolves
--cui-label-root-foreground<color>var(--foreground)