A chrome-less writing surface whose formatting toolbar floats in only when text is selected.
npx shadcn@latest add https://sdk-components.thesqd.com/r/markdown-area.jsonimport { MarkdownArea } from "@/components/ui/markdown-area";import { MarkdownArea } from "@/components/ui/markdown-area";
export function Example() {
return (
<MarkdownArea
defaultValue={"## Hello\n\nWrite **markdown** here."}
aria-label="Notes"
/>
);
}MarkdownArea (props)
├── value? / defaultValue?: string // controlled / uncontrolled markdown
├── onValueChange?: (value) => void
├── placeholder?: string
├── showTitle?: boolean // renders an InvisibleInput title above the toolbar
├── title? / defaultTitle?: string
├── onTitleChange?: (title) => void
├── titlePlaceholder?: string
├── actions?: MarkdownActionId[] // allow-list, in order — any of:
│ // "bold" | "italic" | "strike" | "code" | "codeBlock"
│ // | "h1" | "h2" | "h3" | "link" | "bulletList"
│ // | "orderedList" | "quote"
├── minHeight?: number // min body height in px
├── collapsible?: boolean // clamp when unfocused + "Show more"
├── collapsedLines?: number // collapse after N rows of text
├── collapsedHeight?: number // collapsed height in px (default 160)
├── disabled?: boolean // read-only
└── aria-label?: string
Anatomy
└── MarkdownArea // Tiptap editor, markdown in/out — no chrome
├── InvisibleInput // optional title (when showTitle)
├── EditorContent // live-rendered markdown body
└── BubbleMenu > Toolbar // floating formatting bar, shown on selection| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Controlled markdown value. Pair with `onValueChange`. |
defaultValue | string | "" | Uncontrolled initial markdown value. |
onValueChange | (value: string) => void | — | Fires with the full markdown string on every edit. |
placeholder | string | "Write in markdown…" | Empty-state placeholder for the body. |
showTitle | boolean | false | Renders an `InvisibleInput` title field above the toolbar. |
title / defaultTitle | string | — | Controlled / uncontrolled title value (with `onTitleChange`). |
titlePlaceholder | string | "Untitled" | Placeholder for the title field. |
actions | Array<"bold" | "italic" | "strike" | "code" | "codeBlock" | "h1" | "h2" | "h3" | "link" | "bulletList" | "orderedList" | "quote"> | ["bold","italic","h1","h2","h3","link","bulletList","orderedList","quote","code"] | Allow-list of formatting tools shown in the floating toolbar, in order. |
minHeight | number | 120 | Minimum body height in px; the field grows with content. |
collapsible | boolean | false | Clamp the field to `collapsedHeight` when unfocused and reveal a “Show more” control. Focus expands it; blur collapses it again. |
collapsedLines | number | — | Collapse after N rows of text. Takes precedence over `collapsedHeight`. |
collapsedHeight | number | 160 | Collapsed height in px when `collapsible` and the content overflows. |
disabled | boolean | — | Makes the editor read-only. |
aria-label | string | "Markdown editor" | Accessibility label for the editor body. |