# rich-text-editor-mention

> Rich text editor with at-mention dropdown that inserts users from a suggestion list.

**Framework:** aspnet-mvc  **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/aspnet-mvc/rich-text-editor-mention.json
```

**Install Package(s)**

```bash
Install-Package Syncfusion.AspNetMvc.RichTextEditor
Install-Package Syncfusion.AspNetMvc.Navigations
```

**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/RichTextEditor.cshtml

```cshtml
@using Syncfusion.EJ2
@using EJ2MVCSampleBrowser.Models
@using Syncfusion.EJ2.DropDowns
@section ControlsSection{
    <div class="control-section">
        <div class="control-wrapper">
            @Html.EJS().RichTextEditor("mentionIntegration").ActionBegin("actionBegin").ContentTemplate(@<div>
                <p>Hello <span contenteditable="false" class="e-mention-chip"><a href="mailto:maria@gmail.com" title="maria@gmail.com">@@Maria</a></span>&#8203;</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>).Render()
            @Html.EJS().Mention("mentionRTE").MentionChar((char)ViewData["MentionChar"]).Created("onMentionCreate").Target("#mentionIntegration_rte-edit-view").DataSource((IEnumerable<EmailData>)ViewData["emails"]).AllowSpaces(true).Fields(new MentionFieldSettings { Text = "Name" }).SuggestionCount(8).Highlight(true).DisplayTemplate("<a href='mailto:${ EmailId}'>@${ Name}</a>").ItemTemplate("<table><tr><td><div id=\"mention-TemplateList\"><img class=\"mentionEmpImage\" src=\"../Content/Images/RichTextEditor/${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").Render()
        </div>
    </div>
}

<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;
    }
    #mentionIntegration .e-mention-chip{
         cursor: pointer;
    }
</style>

<script>
       var mentionObj;
        function actionBegin(args) {
            if (args.requestType === 'EnterAction' && mentionObj.element.classList.contains('e-popup-open')) {
                args.cancel = true;
            }
        }
        function onMentionCreate() {
            mentionObj = this;
        }
</script>

```

### src/components/rich-text-editor-mention/RichTextEditorController.cs

```cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Mvc;
using EJ2MVCSampleBrowser.Models;

namespace EJ2MVCSampleBrowser.Models
{
    public class EmailData
    {
        public string Name;
        public string EmailId;
        public string Eimg;
        public string Status;
        public List<EmailData> EmailList()
        {
            return new List<EmailData>
            {
                new EmailData { Name = "Selma Rose",     EmailId = "selma@company.com", Eimg = "1.png",  Status = "e-active" },
                new EmailData { Name = "Russo Kay",      EmailId = "russo@company.com", Eimg = "2.png",  Status = "e-active" },
                new EmailData { Name = "James Nick",     EmailId = "james@company.com", Eimg = "3.png",  Status = "e-active" },
                new EmailData { Name = "Rhoda Barns",    EmailId = "rhoda@company.com", Eimg = "4.png",  Status = "e-active" },
                new EmailData { Name = "Megan Warn",     EmailId = "megan@company.com", Eimg = "5.png",  Status = "e-active" },
                new EmailData { Name = "Robert Bose",    EmailId = "robert@company.com", Eimg = "6.png",  Status = "e-active" },
                new EmailData { Name = "Louise Rob",     EmailId = "louise@company.com", Eimg = "7.png",  Status = "e-active" },
                new EmailData { Name = "Niko Natch",     EmailId = "niko@company.com",  Eimg = "8.png",  Status = "e-active" },
                new EmailData { Name = "Mark Val",       EmailId = "mark@company.com",  Eimg = "9.png",  Status = "e-active" },
                new EmailData { Name = "Tom Davy",       EmailId = "tom@company.com",   Eimg = "10.png", Status = "e-active" }
            };
        }
    }
}

namespace EJ2MVCSampleBrowser.Controllers
{
    public partial class RichTextEditorController : Controller
    {
        public ActionResult MentionIntegration()
        {
            ViewData["emails"] = new EmailData().EmailList();
            ViewData["mentionChar"] = '@';
            return View("~/Views/Home/rich-text-editor/mention/RichTextEditor.cshtml");
        }
    }
}
```
