Markdown Editor

A React markdown editor with a toolbar that wraps the selection, keyboard shortcuts, write, split and preview modes, a safe live preview without innerHTML and a word count.

src/registry/ui/markdown-editor.tsx/r/markdown-editor.json

Installation#

bash
npx shadcn@latest add @minidev/markdown-editor

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/markdown-editor.json

Usage#

tsx
import { MarkdownEditor } from "@/components/ui/markdown-editor"

export function Example() {
  return <MarkdownEditor />
}

API reference#

MarkdownEditor props
PropTypeDefault
valuestring-
defaultValuestringSAMPLE
onChange(value: string) => void-
modeMarkdownEditorMode-
defaultModeMarkdownEditorMode"split"
onModeChange(mode: MarkdownEditorMode) => void-
labelstring"Release notes"
placeholderstring"Write in markdown…"
minHeightnumber300
disabledboolean-
classNamestring-

Dependencies#

npm

lucide-react
All form components