2021-10-14 06:13:50 +08:00
---
description: Ping all your people @marijn @kevin
2021-10-15 03:20:21 +08:00
icon: at-line
2021-10-14 06:13:50 +08:00
---
2021-01-18 21:39:26 +08:00
# Mention
2021-01-25 17:35:52 +08:00
[![Version ](https://img.shields.io/npm/v/@tiptap/extension-mention.svg?label=version )](https://www.npmjs.com/package/@tiptap/extension-mention)
[![Downloads ](https://img.shields.io/npm/dm/@tiptap/extension-mention.svg )](https://npmcharts.com/compare/@tiptap/extension-mention?minimal=true)
2021-01-27 18:52:42 +08:00
Honestly, the mention node is amazing. It adds support for `@mentions` , for example to ping users, *and* provides full control over the rendering.
Literally everything can be customized. You can pass a custom component for the rendering. All examples use `.filter()` to search through items, but feel free to send async queries to an API or add a more advanced library like [fuse.js ](https://fusejs.io/ ) to your project.
2021-01-18 21:39:26 +08:00
2020-12-18 00:13:35 +08:00
## Installation
```bash
# with npm
npm install @tiptap/extension -mention
2021-01-18 21:39:26 +08:00
2020-12-18 00:13:35 +08:00
# with Yarn
yarn add @tiptap/extension -mention
```
2021-01-26 06:17:02 +08:00
## Dependencies
2021-01-27 18:52:42 +08:00
To place the popups correctly, we’ re using [tippy.js ](https://atomiks.github.io/tippyjs/ ) in all our examples. You are free to bring your own library, but if you’ re fine with it, just install what we use:
2021-01-26 06:17:02 +08:00
2021-01-27 18:52:42 +08:00
```bash
# with npm
npm install tippy.js
# with Yarn
yarn add tippy.js
```
2021-01-26 06:17:02 +08:00
## Rendering
2021-01-27 18:52:42 +08:00
Currently, we’ re supporting custom Vue.js components only. To get the required `VueRenderer` install our Vue.js package:
```bash
# with npm
2021-03-01 06:39:29 +08:00
npm install @tiptap/vue -2
2021-01-27 18:52:42 +08:00
# with Yarn
2021-03-01 06:39:29 +08:00
yarn add @tiptap/vue -2
2021-01-27 18:52:42 +08:00
```
2021-06-18 17:56:30 +08:00
If you are using `vue-3` then the `VueRenderer` requires different input:
```js
new VueRenderer(MentionList, {
props: props,
editor: this.editor,
})
```
and not
```js
new VueRenderer(MentionList, {
parent: this,
propsData: props,
})
```
2021-01-27 18:52:42 +08:00
And yes, we plan to support React, too. Meanwhile, you can roll your own `ReactRenderer` , but don’ t forget to share it with the community.
2021-01-26 06:17:02 +08:00
2021-04-16 03:48:19 +08:00
It’ s also possible to use Vanilla JavaScript, but that is probably a lot more work.
2021-01-26 06:17:02 +08:00
2021-01-20 23:56:25 +08:00
## Settings
2021-10-02 07:20:09 +08:00
### HTMLAttributes
Custom HTML attributes that should be added to the rendered HTML tag.
```js
Mention.configure({
HTMLAttributes: {
class: 'my-custom-class',
},
})
```
2021-06-14 22:40:17 +08:00
| renderLabel | `String` | `({ options, node }) => …` | Define how a mention label should be rendered. |
| suggestion | `Object` | `{ … }` | [Read more ](/api/utilities/suggestion ) |
2021-01-20 23:56:25 +08:00
2020-12-18 00:13:35 +08:00
## Source code
2021-04-21 21:31:11 +08:00
[packages/extension-mention/ ](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-mention/ )
2020-12-18 00:13:35 +08:00
## Usage
2021-10-19 00:01:47 +08:00
https://embed.tiptap.dev/preview/Nodes/Mention