Mentions

Mention component.

Mentions

When to use

When need to mention someone or something.


Basic

Basic usage.

Asynchronous loading

Async

With Form

Controlled mode, for example, to work with Form.
   

Customize Trigger Token

Customize Trigger Token by prefix props. Default to @, Array<string> also supported.

Placement

Change the suggestions placement.

Disabled or readOnly

Configurate disabled and readOnly.

Auto Size

Height autoSize.

API

Mention
PropertyDescriptionTypeDefault
autoFocus
Auto get focus when component mounted
boolean
false
defaultValue
Default value
string
-
filterOption
Customize filter option logic
false | (input: string, option: OptionProps) => boolean
-
notFoundContent
Set mentions content when not match
ReactNode
Not Found
placement
Set popup placement
top | bottom
bottom
prefix
Set trigger prefix keyword
string | string[]
@
split
Set split string before and after selected mention
string
validateSearch
Customize trigger search logic
(text: string, props: MentionsProps) => void
-
value
Set value of mentions
string
-
onChange
Trigger when value changed
(text: string) => void
-
onSelect
Trigger when user select the option
(option: OptionProps, prefix: string) => void
-
onSearch
Trigger when prefix hit
(text: string, prefix: string) => void
-
onFocus
Trigger when mentions get focus
() => void
-
onBlur
Trigger when mentions lose focus
() => void
-
getPopupContainer
Set the mount HTML node for suggestions
() => HTMLElement
-
autoSize
Textarea height autosize feature, can be set to true | false or an object { minRows: 2, maxRows: 6 }
boolean | object
false
onResize
The callback function that is triggered when textarea resize
function({ width, height })
-
Mention methods
PropertyDescriptionTypeDefault
blur()
Remove focus
-
focus()
Get focus
-
Option
PropertyDescriptionTypeDefault
children
Suggestion content
ReactNode
-
value
The value of suggestion, the value will insert into input filed while selected
string
-