Mention
Mention component.
When To Use#
When need to mention someone or something.
Examples#
Basic#
我想吃一份{{食物}}
Creatable#
我想吃一份{{食物}}
Creatable & Highlight Invalid#
我想吃一份{{食物}}
Disabled#
我想吃一份{{食物}}
I want a {{food}}
Something went wrong!
API#
| Property | Description | Type | Default |
|---|---|---|---|
| suggestions | Suggestion content | string[] | [] |
| disabled | Tell if the mention is disabled. | boolean | false |
| creatable | Create suggestion when mention text which is not exists in suggestions props | boolean | false |
| highlightInvalid | highlight the invalid mentioned text | boolean | false |
| formatCreateText | format the create text | (text: string) => string | text => Press Enter to create mention: {text} |
| onMentionCreate | Trigger when the new suggestion created | (newMention: string) => void | |
| value | Set value of mentions | string | |
| defaultValue | Default value | string | |
| onBlur | Trigger when mentions lose focus | () => void | |
| onChange | Trigger when value changed | (value: string) => void |