ValyroUI Русская версия

Mentions Input

Text with @mentions and #tags, async suggestions. Pro · Forms and input › Text

Textarea with @mentions and #tags: typing a trigger opens suggestions next to it, mentions are highlighted in the text and behave as one unit, and the value is markup you can store. With name, a form submits the plain text as shown; the markup with ids comes from onValueChange.

Installation

npx valyro-cli@latest login
npx valyro-cli@latest add mentions-input
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { MentionsInput } from 'valyro-ui-pro';

Props

PropTypeDefault
valuestringMarkup: plain text with mentions written as @[Display name](id).
defaultValuestring''Initial value when uncontrolled.
onValueChange(value: string, details: MentionsInputDetails) => voidCalled with the new value when it changes.
triggersstring[]['@', '#']Characters that start a mention (default @ and #).
onSearch *(query: string, trigger: string) => MentionOption[] | Promise<MentionOption[]>Suggestions for the text typed after a trigger; may be async.
minRowsnumber3Rows shown before the field grows (default 3).
maxRowsnumber8Rows the field grows to before it scrolls (default 8).
invalidbooleanfalseError border and aria-invalid on the textarea (an explicit aria-invalid wins).
labelsPartial<MentionsInputLabels>Overrides for the built-in English text; keys left out keep their defaults.

Related components

Previous: Search Input · Next: Tags Input · All Forms and input