Skip to content
Calm motion: animations on this site only fade, with no movement

Mention ​

@ / # suggestions inside a textarea

A Textarea that offers people, tags or anything else when you type @ or #. The result is plain text (@mika) so you store and parse it however you like. For picking from a list without free text, use Combobox.

Basic
type @ or #, ↑ ↓ to choose, Enter or Tab to insert, Esc to close
  • A trigger opens the list only at the start of a word, so mail@host stays plain. Typing after it filters by label or value. No match closes the list.
  • ↑ ↓ choose (they wrap), Enter or Tab inserts @value and a space, Esc closes. Clicking an option works too, and the caret lands after the insert.
  • Pass options as one list for every trigger (triggers says which characters, default @), or as { "@": people, "#": tags } to give each its own list.
  • The list sits under the textarea, not at the caret, so it never covers the line you are writing.
  • Every other prop and attribute (rows, description, error, maxlength…) goes to the Textarea.
  • select gives you (option, trigger) when something is inserted.

Usage ​

ts
import { BlessMention } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
options*BlessMentionOption[] | Record<string, BlessMentionOption[]>—one list for every trigger, or `{ "@": [...], "#": [...] }` to give each its own
triggersstring[]["@"]characters that open the list when they start a word; ignored when `options` is a record
limitnumber8
labelstring"Suggestions"
modelValuestring""

Events

NamePayloadDescription
select[option: BlessMentionOption, trigger: string]
update:modelValue[value: string]

Released under the MIT License. Character names and artwork belong to their owners.