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
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 />
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 />
Installation
Use this command to install the component.
Usage
Dependencies
src/registry/sources/control-ui/markdown-editor/bubble-menu.tsxSupportsrc/registry/sources/control-ui/markdown-editor/context.tsSupportsrc/registry/sources/control-ui/markdown-editor/drag-handle.tsxSupportsrc/registry/sources/control-ui/markdown-editor/drag-preview.tsSupportsrc/registry/sources/control-ui/markdown-editor/extensions.tsSupportsrc/registry/sources/control-ui/markdown-editor/suggestions.tsxSupportsrc/registry/sources/control-ui/markdown-editor/task-item.tsxSupportsrc/registry/sources/control-ui/markdown-editor/toolbar.tsxSupportsrc/registry/sources/control-ui/markdown-editor/uploads.tsSupportsrc/registry/sources/control-ui/markdown-editor/use-image-uploads.tsSupportsrc/registry/sources/control-ui/ui/label.tsxSupportbuttonComponentChatComposerAttachmentchat-composer-attachmentKitCheckboxcheckboxComponentDropdownMenudropdown-menuComponentInputinputComponentLive statuslive-statusComponentPopoverpopoverComponentScroll areascroll-areaComponentTextareatextareaComponentToolbartoolbarComponentTooltiptooltipComponentTrigger Menutrigger-menuComponentTypographytypographyComponentRaw code
Installed component source and support files
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)