# rich-text-editor-mention

> Rich text editor sample integrating mentions and user tag suggestions in content.

**Framework:** javascript  **Component:** RichTextEditor  **Variant:** mention

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/javascript/rich-text-editor-mention.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-richtexteditor
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/rich-text-editor-mention/rich-text-editor.html

```html
<div class="control-section">
    <div class="sample-container">
        <div class="default-section">
            <div id="mentionEditor"></div>
            <div id="container">
		<p>Hello 
                    <span contenteditable="false" class="e-mention-chip"><a href="mailto:maria@gmail.com" title="maria@gmail.com">@Maria</a></span>
                </p>
                <p>Welcome to the mention integration with rich text editor demo. Type <code>@</code> character and tag user from the suggestion list. </p>
            </div>
        </div>
    </div>
</div>

<!-- custom code start -->
<style>
    #mention-TemplateList {
        position: relative;
        display: inline-block;
        padding: 2px;
    }
    .person, .email {
        display: block;
        line-height: 20px;
        text-indent: 5px;
    }
    .person {
        font-size: 16px;
    }
    .mentionEmpImage {
        display: inline-block;
        width: 46px;
        height: 46px;
        padding: 3px;
        border-radius: 25px;
    }
    #mention-TemplateList .e-badge-success {
        left: 76%;
        bottom: 4px;
        top: auto;
    }
    #mention_integration_rte-edit-view_popup .e-dropdownbase .e-list-item {
        line-height: 8px;
    }
    #mention-TemplateList .e-badge-success {
        background-color: #4d841d;
		color: #fff;
    }
    #mention-TemplateList .e-badge-success.away {
        background-color: #fedd2d;
		color: #fff;
    }
	#mention-TemplateList .e-badge-success.busy {
        background-color: #de1a1a;
		color: #fff;
    }
    #mention-TemplateList .e-badge.e-badge-dot {
        height: 10px;
        width: 10px;
    }
    #mention_integration .e-mention-chip{
        cursor: pointer;
    }
</style>
<!-- custom code end -->

```

### src/components/rich-text-editor-mention/rich-text-editor.ts

```typescript
import { RichTextEditor, Toolbar, Link, Image, HtmlEditor, QuickToolbar, PasteCleanup, Table, Video, Audio, ClipBoardCleanup, AutoFormat } from '@syncfusion/ej2-richtexteditor';
RichTextEditor.Inject(Toolbar, Link, Image, HtmlEditor, QuickToolbar, PasteCleanup, Table, Video, Audio, ClipBoardCleanup, AutoFormat);
import { Mention } from '@syncfusion/ej2-dropdowns';
import { emailData } from '../datasource/rich-text-editor-data';

export function initRichTextEditorMention(): void {

    let emailObj: Mention;
    let defaultRTE: RichTextEditor = new RichTextEditor({
        placeholder: 'Type @ and tag the name'
     });
    defaultRTE.appendTo('#container');

    // Initialize Mention component.
        emailObj = new Mention({
        dataSource: emailData,
        fields: { text: 'Name' },
        suggestionCount: 8,
        displayTemplate: '<a href=mailto:${EmailId} title=${EmailId}>@${Name}</a>',
        itemTemplate: '<table><tr><td><div id="mention-TemplateList"><img class="mentionEmpImage" src="src/rich-text-editor/images/${Eimg}.png" alt="employee" /><span class="e-badge e-badge-success e-badge-overlap e-badge-dot e-badge-bottom ${Status}"></span></div></td><td><span class="person">${Name}</span><span class="email">${EmailId}</span></td</tr></table>',
        popupWidth: '250px',
        popupHeight: '200px',
        target: defaultRTE.inputElement,
        allowSpaces: true,
        suffixText: '&nbsp;'

    });
    emailObj.appendTo('#mentionEditor');
}

```
