Mention
Mention nodes fed by your own records through a suggestion list.
Mention records are your own data. The node stores the id and the label as `data-id` and `data-label`, so the rendered HTML survives a round trip through your backend.
Preview
Installation
Add the item with the shadcn CLI, or copy the source manually.
pnpm dlx shadcn@latest add litingyes/blocove/rich-text-editor-mentionRequires a shadcn/ui project set up with Base UI primitives. Blocove is developed against the b0 preset, but it installs no base config or theme tokens: your own preset, fonts and colors stay in place.
Or install from the namespace after adding the registry: npx shadcn@latest add @blocove/rich-text-editor-mention
Typography is provided by shadcn/typeset. Copy
typeset.css next to your stylesheet, import it after Tailwind and add the .typeset-docs preset. See the Rich text editor setup.Usage
Pass your own records
import { EditorMention } from "@/components/blocove/rich-text-editor/mention"
const users = [ { id: "42", label: "Ada Lovelace" }, { id: "43", label: "Alan Turing" },]
export function CommentEditor() { return ( <Editor> <EditorMention users={users} /> <EditorContent /> </Editor> )}API Reference
Props accepted by the exported components.
EditorMention
Registers the mention node and the suggestion list built from the records you pass in.
| Prop | Type | Default |
|---|---|---|
users | MentionUser[] | Three demo users |
char | string | "@" |
ariaLabel | string | "Mention" |
HTMLAttributes | Record<string, string> | {} |