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.

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.

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

Installation

Use this command to install the component.

Registry command
See registry manifest

Usage

Dependencies

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
ButtonbuttonPrimitiveChatComposerAttachmentchat-composer-attachmentComponentCheckboxcheckboxPrimitiveDropdownMenudropdown-menuPrimitiveInputinputPrimitiveLive statuslive-statusPrimitivePopoverpopoverPrimitiveScroll areascroll-areaPrimitiveTextareatextareaPrimitiveToolbartoolbarPrimitiveTooltiptooltipPrimitiveTrigger Menutrigger-menuPrimitiveTypographytypographyPrimitive

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)