Introducing the New Angular Mention Component | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (172).NET Core  (29).NET MAUI  (192)Angular  (107)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (40)Black Friday Deal  (1)Blazor  (209)BoldSign  (12)DocIO  (24)Essential JS 2  (106)Essential Studio  (200)File Formats  (63)Flutter  (131)JavaScript  (219)Microsoft  (118)PDF  (80)Python  (1)React  (98)Streamlit  (1)Succinctly series  (131)Syncfusion  (882)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (49)Windows Forms  (61)WinUI  (68)WPF  (157)Xamarin  (161)XlsIO  (35)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (146)Chart  (125)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (62)Development  (613)Doc  (7)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (37)Extensions  (22)File Manager  (6)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (488)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (41)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (10)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (368)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (30)Visual Studio Code  (17)Web  (577)What's new  (313)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Introducing the New Angular Mention Component

Introducing the New Angular Mention Component

We are happy to introduce the new Angular Mention component in our 2022 Volume 3 release. It provides one of the most anticipated features for all our editor components.

Let’s explore the Angular Mention component, its UI design, and its features with code examples.

Overview

The new Angular Mention component provides @mention and #hashtag functionality for any editor control. It lets users tag or select a user or group name from a suggestion list. It has several out-of-the-box features such as data binding, grouping, UI customization, accessibility, and more.

Key features

The following are the key features of the Angular Mention component:

Data binding

The Angular Mention component supports different types of data sources, such as arrays of primitive data, JSON data collections, and remote data sources using adapters such as OData, OData V4, URLs, JSON, and web APIs.

The following code example shows how to bind a string of array data.

[app.component.ts]

import { Component } from ‘@angular/core’;
 
@Component({
 selector: ‘app-root’,
 // Specifies the template string for the Mention component.
 Template: `<div id=”commentBox” placeholder=”Type @ and tag user” ></div><ejs-mention [dataSource]=’userData’ [target]=’commentTarget’></ejs-mention>`
})
export class AppComponent {
 constructor() {
 }
 // Defines the array of data.
 Public userData: string[] = [‘Selma Rose’, ‘Russo Kay’, ‘Camden Kate’, ‘Garth’, ‘Margaret’, ‘Robert’, ‘Albert’, ‘Michael’];
 // Sets target editor or editable element.
 Public commentTarget: string = ‘#commentBox’;
}

Customize mention character

You can easily customize the mentioned character using the mentionChar property. Then, you can show or hide the mentioned character while tagging or selecting items by using the showMentionChar property. You can also use multiple mention characters that correspond to different suggestion lists within a single editor.

Customizing the Mention Character in the Angular Mention Component
Customizing the Mention Character in the Angular Mention Component

Note: For more details, refer to our multiple suggestion list example for the Angular Mention component.

Highlight the matched text

The Angular Mention component has the option to configure different visual appearances for the matching text of each suggestion through the highlight property.

Highlighting the Matched Text in the Angular Mention Component
Highlighting the Matched Text in the Angular Mention Component

Suggestion list items with icons

The Angular Mention component comes with built-in icon support for visual representations of the suggestion items. To enable this feature, configure the CSS class name through the data source and map the fields.iconCss property for each item.

Angular Mention Component Showing the Suggestion List Items with Icons
Angular Mention Component Showing the Suggestion List Items with Icons

Categorize the suggestions list items

You can organize suggestions into groups based on different categories. The category for each list item can be mapped through the groupBy field in the data source.

Categorizing the Suggestion List Items in the Angular Mention Component
Categorizing the Suggestion List Items in the Angular Mention Component

Sorting the suggestions list items

The Angular Mention component has built-in support to display the suggestion list items in ascending or descending order using the sortOrder property.

UI customization with templates

To create custom user experiences, use the template option in the Angular Mention component. You can customize the suggestion list items, selection display text, no-record display, and data loading spinner using the template support.

Customizing the Angular Mention Component UI with Templates
Customizing the Angular Mention Component UI with Templates

Note: For more details, refer to the example for the Angular Mention component template.

Web accessibility and keyboard support

The Angular Mention component supports keyboard interaction and web accessibility standards based on the WAI-ARIA specifications, roles, and states. The supported keyboard shortcuts are as follows:

  • Down arrow: After the pop-up list opens, press the Down arrow key to move to the next list item. If it is the last item, then the selection will focus on the first item in the list.
  • Up arrow: After the pop-up list opens, press the Up arrow key to move to the previous list item. If it is the first item, then the selection will focus on the last item in the list.
  • Home/Page up: Moves to the first item in the list after the pop-up list opens.
  • End/Page down: Moves to the last item in the list after the pop-up list opens.
  • Esc: Closes the pop-up list if it is in the open state.
  • Enter: Selects the focused item, and when the pop-up list is in an open state it closes.
  • Tab: Focuses on the next TabIndex element on the page when the pop-up list is closed. Otherwise, inserts the selected pop-up list item and close the pop-up list.

How to use it

You can include the Mention component in the rich text editor, text area, text box, or other editable components. It has a huge set of resources for developers, including source code on GitHub, live demos, and thoroughly explained customization features in its documentation.

Supported platforms

The Mention component is also available on the following platforms.

PlatformLive demosDocumentation
ReactReact Mention demosGetting started with React Mention
VueVue Mention demosGetting started with Vue Mention
JavaScriptJavaScript Mention demosGetting started with JavaScript Mention
ASP.NET CoreASP.NET Core Mention demosGetting started with ASP.NET Core Mention
ASP.NET MVCASP.NET MVC Mention demosGetting started with ASP.NET MVC Mention

Harness the power of Syncfusion’s feature-rich and powerful Angular UI components.

Conclusion

Thanks for reading! In this blog, we have seen the features of the new Angular Mention component that rolled out in our 2022 Volume 3 release. These features are also listed on our Release Notes and the What’s New pages. Try out the component and share your feedback as comments on this blog.

You can also reach us through our support forumssupport portal, or feedback portal. We are always happy to assist you!

Related blogs

 

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed
Scroll To Top