Mention Integration in Blazor RichTextEditor

28 Dec 20225 minutes to read

By integrating the Mention component with a Rich Text Editor, users can easily mention or tag other users or objects from the suggested list without having to manually type out their names or other identifying information.

The Target property of the Mention component allows you to specify the ID of the content editable div element within the Rich Text Editor that you want to bind the Mention component to. This allows you to enable the Mention functionality within the Rich Text Editor, so that users can mention or tag other users or objects from the suggested list while editing the text.

When the user types the @ symbol followed by a character, the Rich Text Editor will display a list of suggestions for items that the user can select from. The user can then select an item from the list by clicking on it, or by typing the name of the item they want to tag.

In the following sample, configured the following properties with popup dimensions.

  • AllowSpaces - Allow to continue search action if user enter space after mention character while searching.
  • SuggestionCount - The maximum number of items that will be displayed in the suggestion list.
  • ItemTemplate - Used to display the customized appearance in suggestion list.
  • @using Syncfusion.Blazor.DropDowns
    @using Syncfusion.Blazor.RichTextEditor
    <SfRichTextEditor ID="mentionIntegration">
        <span contenteditable="false" class="e-mention-chip"><a title="">@@Maria</a></span>
        <p>Welcome to the mention integration with rich text editor demo. Type <code>@@</code> character and tag user from the suggestion list. </p>
    <div id="mention_integration">
        <SfMention TItem="PersonData" Target="#mentionIntegration_rte-editable" DataSource="@EmailData" SuggestionCount=8 AllowSpaces="true" PopupHeight="200px" PopupWidth="250px">
                        <td><div id="mention-TemplateList"><img class="mentionEmpImage" src="/images/@((context as PersonData).EmployeeImage)" alt="employee" />
                            <span class="e-badge e-badge-success e-badge-overlap e-badge-dot e-badge-bottom @((context as PersonData).Status)"></span></div></td>
                        <td><span class="person">@((context as PersonData).Name)</span><span class="email">@((context as PersonData).EmailId)</span></td>
                <a title="@((context as PersonData).EmailId)">@@@((context as PersonData).Name)</a>
            <MentionFieldSettings Text="Name"></MentionFieldSettings>
        #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;
    @code {
      public class PersonData
        public string Name { get; set; }
        public string EmailId { get; set; }
        public string EmployeeImage { get; set;}
        public string Status { get; set;}
      List<PersonData> EmailData = new List<PersonData> {
        new PersonData() { Name="Selma Rose",  Status = "active", EmployeeImage="2.png", EmailId="" },
        new PersonData() { Name="Russo Kay",  Status = "away", EmployeeImage="8.png", EmailId="" },
        new PersonData() { Name="Camden Kate", Status = "busy", EmployeeImage="9.png", EmailId="" },
        new PersonData() { Name="Garth", Status = "active",  EmployeeImage="7.png", EmailId="" },
        new PersonData() { Name="Ursula Ann", Status = "busy", EmployeeImage="3.png", EmailId="" },
        new PersonData() { Name="Margaret", Status = "active", EmployeeImage="10.png", EmailId="" },
        new PersonData() { Name="Laura Grace", Status = "away", EmployeeImage="1.png", EmailId="" },
        new PersonData() { Name="Robert", Status = "busy", EmployeeImage="dp.png", EmailId="" },
        new PersonData() { Name="Albert", Status = "away", EmployeeImage="8.png", EmailId="" },
        new PersonData() { Name="Michale", Status = "active", EmployeeImage="4.png", EmailId="" },
        new PersonData() { Name="Andrew James", Status = "active", EmployeeImage="db.png", EmailId="" },
        new PersonData() { Name="William", Status = "active", EmployeeImage="10.png", EmailId="" }

    Blazor RichTextEditor mention integration

    View Sample

    See Also