logoAnt Design

⌘ K
  • 디자인
  • 개발
  • 컴포넌트
  • 블로그
  • 자료
5.21.3
  • Components Overview
  • General
    • Button
    • FloatButton
      5.0.0
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
      5.10.0
    • Grid
    • Layout
    • Space
    • Splitter
      5.21.0
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
      5.5.0
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
    • Popover
    • QRCode
      5.1.0
    • Segmented
    • Statistic
    • Table
    • Tabs
    • Tag
    • Timeline
    • Tooltip
    • Tour
      5.0.0
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
      5.1.0
  • Other
    • Affix
    • App
      5.1.0
    • ConfigProvider
    • Util
      5.13.0

Mentions

Used to mention someone or something in an input.
가져오기import{ Mentions }from"antd";
소스components/mentions
문서
이 페이지 수정변경 로그

Resources

Ant Design Charts
Ant Design Pro
Ant Design Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Landing-Landing Templates
Scaffolds-Scaffold Market
Umi-React Application Framework
dumi-Component doc generator
qiankun-Micro-Frontends Framework
ahooks-React Hooks Library
Ant Motion-Motion Solution
China Mirror 🇨🇳

Community

Awesome Ant Design
Medium
Twitter
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference
Work with Us

Help

GitHub
Change Log
FAQ
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community
loading

When To Use

When you need to mention someone or something.

Usage upgrade after 5.1.0

Upgrade Tip

After version 5.1.0, we provide a simpler usage <Mentions options={[...]} /> with better performance and potential of writing simpler code style in your applications. Meanwhile, we deprecated the old usage in browser console, we will remove it in antd 6.0.

// works when >=5.1.0, recommended ✅
const options = [{ value: 'sample', label: 'sample' }];
return <Mentions options={options} />;
// works when <5.1.0, deprecated when >=5.1.0 🙅🏻‍♀️
return (
<Mentions onChange={onChange}>
<Mentions.Option value="sample">Sample</Mentions.Option>
</Mentions>
);

Examples

API

Common props ref:Common props

Mention

PropertyDescriptionTypeDefaultVersion
allowClearIf allow to remove mentions content with clear iconboolean | { clearIcon?: ReactNode }false5.13.0
autoFocusAuto get focus when component mountedbooleanfalse
autoSizeTextarea height autosize feature, can be set to true | false or an object { minRows: 2, maxRows: 6 }boolean | objectfalse
defaultValueDefault valuestring-
filterOptionCustomize filter option logicfalse | (input: string, option: OptionProps) => boolean-
getPopupContainerSet the mount HTML node for suggestions() => HTMLElement-
notFoundContentSet mentions content when not matchReactNodeNot Found
placementSet popup placementtop | bottombottom
prefixSet trigger prefix keywordstring | string[]@
splitSet split string before and after selected mentionstring
statusSet validation status'error' | 'warning' | 'success' | 'validating'-4.19.0
validateSearchCustomize trigger search logic(text: string, props: MentionsProps) => void-
valueSet value of mentionsstring-
variantVariants of Inputoutlined | borderless | filledoutlined5.13.0
onBlurTrigger when mentions lose focus() => void-
onChangeTrigger when value changed(text: string) => void-
onClearCallback when click the clear button() => void-5.20.0
onFocusTrigger when mentions get focus() => void-
onResizeThe callback function that is triggered when textarea resizefunction({ width, height })-
onSearchTrigger when prefix hit(text: string, prefix: string) => void-
onSelectTrigger when user select the option(option: OptionProps, prefix: string) => void-
optionsOption ConfigurationOptions[]5.1.0

Mention methods

NameDescription
blur()Remove focus
focus()Get focus

Option

PropertyDescriptionTypeDefault
labelTitle of the optionReact.ReactNode-
keyThe key value of the optionstring-
disabledOptionalboolean-
classNameclassNamestring-
styleThe style of the optionReact.CSSProperties-

Design Token

컴포넌트 토큰어떻게 사용하나요?

토큰 이름설명타입기본값
activeBg输入框激活状态时背景颜色string#ffffff
activeBorderColor激活态边框色string#1677ff
activeShadow激活态阴影string0 0 0 2px rgba(5, 145, 255, 0.1)
addonBg前/后置标签背景色stringrgba(0, 0, 0, 0.02)
controlItemWidth菜单项高度string | number100
dropdownHeight弹层高度string | number250
errorActiveShadow错误状态时激活态阴影string0 0 0 2px rgba(255, 38, 5, 0.06)
hoverBg输入框hover状态时背景颜色string#ffffff
hoverBorderColor悬浮态边框色string#4096ff
inputFontSize字体大小number14
inputFontSizeLG大号字体大小number16
inputFontSizeSM小号字体大小number14
paddingBlock输入框纵向内边距number4
paddingBlockLG大号输入框纵向内边距number7
paddingBlockSM小号输入框纵向内边距number0
paddingInline输入框横向内边距number11
paddingInlineLG大号输入框横向内边距number11
paddingInlineSM小号输入框横向内边距number7
warningActiveShadow警告状态时激活态阴影string0 0 0 2px rgba(255, 215, 5, 0.1)
zIndexPopup弹层 z-indexnumber1050

글로벌 토큰어떻게 사용하나요?

Basic
codepen icon
External Link Icon
expand codeexpand code
Asynchronous loading
codepen icon
External Link Icon
expand codeexpand code
Customize Trigger Token
codepen icon
External Link Icon
expand codeexpand code
Placement
codepen icon
External Link Icon
expand codeexpand code
autoSize
codepen icon
External Link Icon
expand codeexpand code
_InternalPanelDoNotUseOrYouWillBeFired
codepen icon
External Link Icon
expand codeexpand code
Variants
codepen icon
External Link Icon
expand codeexpand code
5.13.0
With Form
codepen icon
External Link Icon
expand codeexpand code
disabled or readOnly
codepen icon
External Link Icon
expand codeexpand code
With clear icon
codepen icon
External Link Icon
expand codeexpand code
Status
codepen icon
External Link Icon
expand codeexpand code
Component Token
codepen icon
External Link Icon
expand codeexpand code