Markdown Editor

Compact rich text editor powered by Tiptap, embedded in a form field, with a markdown formatting toolbar, variants, and an invalid state.

import { MarkdownEditor } from "@plexui/vue/components/MarkdownEditor";

Examples

Placeholder


All formatting

This is regular text with bold and italic formatting.

Read our Privacy Policy and Terms of Service for details.

  1. First ordered item

  2. Second ordered item

  3. Third ordered item

  • Unordered item one

  • Unordered item two

  • Unordered item three

Formats and line breaks

Some bold, italic and a link.

A list item

Line one
Line two

Markdown: "Some **bold**, *italic* and a [link](https://example.com).\n\n- A list item\n\nLine one\nLine two"

With Field

Supports bold, italic, lists, and links.


Toolbar end slot


Variants



API

PropTypeDefaultDescription
variant"outline" | "soft""outline"Visual style of the editor
disabledbooleanfalseDisable the editor
invalidbooleanfalseMark as invalid
placeholderstring—Placeholder text when empty
value / v-model:valuestring—Controlled markdown value; `update:value` fires on every change
default-valuestring—Initial markdown for uncontrolled mode
@change(markdown: string) => void—Called on content change
formatsArray<"bold" | "italic" | "orderedList" | "bulletList" | "link">all fiveFormats the editor offers, read when it is created. One left out has no button, shortcut or input rule, and markdown with it keeps only its text
breaksbooleanfalseA single newline is a line break, read and written as one newline (read when the editor is created). Without it a line break is written as a backslash and a newline
toolbarEnd slotVNode[]—Content rendered at the end of the toolbar
rowsnumber1Minimum visible rows
idstring—id of the editable element (Field sets it)
aria-labelstring—Accessible name of the editable element
aria-labelledbystring—Id of the element that names the editor, such as a visible label
aria-describedbystring—aria-describedby of the editable element (Field sets it)
aria-invalidboolean—Sets aria-invalid on the editable element and the invalid style (Field sets it with error-message)
classstring—Applied to the container

The editable element is a textbox with aria-multiline. A <label for>, including the label Field renders, cannot name a contenteditable region, so give the editor aria-label, or aria-labelledby pointing at a visible label. Toolbar buttons are toggles (aria-pressed) that follow the formatting at the caret, and a click in the text places the caret there. In the link dialog, Enter in a field saves the link, Enter on a button runs that button, Escape cancels, and Tab stays inside the dialog. Like the React component, update:value and change also fire once when the editor is created and whenever disabled changes.

Styling

Markdown Editor reads these component tokens. Override them at any scope to restyle it:

  • --input-border-color-invalid: border color invalid (default var(--color-border-danger-outline))
  • --input-outline-border-color: outline border color (default var(--color-border-primary-outline))
  • --input-outline-border-color-focus: outline border color focus (default var(--alpha-50))
  • --input-outline-border-color-hover: outline border color hover (default light-dark(var(--alpha-25), var(--alpha-30)))
  • --input-placeholder-text-color: placeholder text color (default var(--color-text-tertiary))
  • --input-soft-background-color: soft background color (default var(--color-background-primary-soft-alpha))
  • --input-soft-border-color-focus: soft border color focus (default var(--alpha-20))
  • --link-primary-text-color: primary text color (default light-dark(var(--blue-500), var(--blue-300)))