JGuang

Mentions

Mentions · Arco Design

Preview
npm install @arco-design/web-react@2.66.18

Mentions

Mentions is used to mention someone or something in the input.

Install

npm install @arco-design/web-react@2.66.18

Import @arco-design/web-react/dist/css/arco.css at the entry and set the locale with ConfigProvider. React 19 projects must also import @arco-design/web-react/es/_util/react-19-adapter first, or imperative APIs such as Message and Modal cannot render.

Examples

  • Basic: Used to mention someone or something, often used for posting, chatting or commenting.
  • Custom Trigger Word: Specify prefix to customize the trigger character. The default is @, which can be customized to any character.
  • Controlled: An example that Mentions is used with Form,
  • Disabled & ReadOnly: Set whether to be disabled via disabled, and set whether to be readonly via readOnly property.

Examples come from the official Arco Design repository (MIT) at the commit published as npm 2.66.18. Some use online images or upload endpoints; network requests are disabled in previews.

API

Mentions

PropertyDescriptionTypeDefaultValueVersion
alignTextareaWhether the popup is aligned with the inputbooleantrue-
allowClearWhether allow clear the contentboolean-2.2.0
disabledWhether the textarea is disabledboolean--
errorWhether the textarea is error.(Deprecated, removed in the next major version, use status='error' instead)boolean--
defaultValueTo set default valuestring--
placeholdertextarea placeholderstring--
splitSet split string before and after selected mentionstring--
valueTo set valuestring--
positionPosition of dropdown'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br'bl-
statusStatus'error' | 'warning'-2.45.0
clearIconConfigure the icon of the clear button when allowClear.ReactNode-2.50.0
notFoundContentThe content displayed when there is no dataReactNode--
autoSizeHeight autoSize featureboolean | { minRows?: number; maxRows?: number }--
classNameAdditional css classstring | string[]--
optionsOptions of dropdown(| string| number| { label: ReactNode | string; value: string | number; disabled?: boolean })[]--
prefixSet trigger prefix keywordstring | string[]@-
styleAdditional styleCSSProperties--
triggerPropsAll Trigger component propsPartial<TriggerProps>--
wrapperStyleWith showWordLimit, a div will be outside the textarea tag, and wrapperStyle is used to configure the style of it.CSSProperties--
filterOptionCustomize filter option logicfalse | ((inputValue: string, option) => boolean)--
getPopupContainerSet the mount HTML node for suggestions(node: HTMLElement) => HTMLElement--
onBlurTrigger when mentions lose focus(e) => void--
onChangeCallback when input value is changed(value: string) => void--
onClearCallback when click clear button() => void-2.2.0
onFocusTrigger when mentions get focus(e) => void--
onPressEnterCallback when press enter key(e) => void--
onSearchCallback on search(text: string, prefix: string) => void--