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
- A trigger opens the list only at the start of a word, so
mail@hoststays plain. Typing after it filters by label or value. No match closes the list. - ↑ ↓ choose (they wrap), Enter or Tab inserts
@valueand a space, Esc closes. Clicking an option works too, and the caret lands after the insert. - Pass
optionsas one list for every trigger (triggerssays 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. selectgives you(option, trigger)when something is inserted.
Usage
ts
import { BlessMention } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
options* | BlessMentionOption[] | Record<string, BlessMentionOption[]> | — | one list for every trigger, or `{ "@": [...], "#": [...] }` to give each its own |
triggers | string[] | ["@"] | characters that open the list when they start a word; ignored when `options` is a record |
limit | number | 8 | |
label | string | "Suggestions" | |
modelValue | string | "" |
Events
| Name | Payload | Description |
|---|---|---|
select | [option: BlessMentionOption, trigger: string] | |
update:modelValue | [value: string] |