Skip to main content
Neural UIv2.1.0Documentation
View v1

Mention

Insert mentions into a message from application-provided suggestions.

Category
Forms and selection
Import
@neural-ui/core/mention
Selector
neu-mention
import { NeuMentionComponent } from '@neural-ui/core/mention';

Overview

Mention detects an @ query in the current text and lets the application supply matching entries. A selected entry is written into the value.

Mention a teammate

Type @ followed by a few letters, then choose a suggestion. The example discards outdated responses if the query changes.

Mention a teammate
Selected ยท โ€”

Value ยท

Configurator

Edit the visible label and try required, read only and disabled states.

Configurator

Live preview

Selected ยท โ€”
template.html
<neu-mention [label]="label()" [(value)]="value" [suggestions]="suggestions()" [disabled]="disabled()" [readonly]="readonly()" [required]="required()" (queryChange)="search($event)" (suggestionSelected)="chosen.set($event.label)" />

State and events

Bind value as a model. Handle queryChange to supply suggestions and suggestionSelected to respond to a selection.

Accessibility and keyboard

The examples use visible labels and follow the focus order of the live controls.

Key
Action
Arrow Down / Arrow Up Move the active option while suggestions are open.
Enter Insert the active suggestion.
Escape Close the suggestion list.

API

Configure the suggestion list and popup behavior, then read selection events and text changes.

Inputs

Configure the component with [property]="value". Your application supplies these values; the component does not replace the state you pass in.

Name
Type
Default
Template binding
Description
disabledbooleanfalse[disabled]Prevent interaction with the field.
invalidbooleanfalse[invalid]Marks the field as invalid.
labelstringRequired[label]Visible label for the message field.
readonlybooleanfalse[readonly]Show the text without allowing edits.
requiredbooleanfalse[required]Expose the required state to the field.
suggestionsreadonly NeuMentionSuggestion[][][suggestions]Suggestions for the current query.
suggestionsLabelstringinject(NEURAL_LOCALE).toLowerCase().startsWith('es') ? 'Sugerencias de menciones' : 'Mention suggestions'Derived default[suggestionsLabel]Accessible name of the suggestions list.

Models

A model supports [(property)]="signal" or the [property] and (propertyChange) pair. Choose one form, not both.

Name
Type
Default
Template binding
Description
valuestring''[(value)]Current message, including inserted mentions.

Outputs

Listen to an event with (event)="handler($event)". The table explains the data your handler receives and how to use it.

Name
Payload
Template binding
Description
queryChangestring | null(queryChange)="onQueryChange($event)"Reports the active query or null when it ends.
suggestionSelectedNeuMentionSuggestion(suggestionSelected)="onSuggestionSelected($event)"Reports the selected suggestion.
touchvoid(touch)="onTouch($event)"Reports that focus left the field.

Templates

ng-content projects content into the component. TemplateRef inputs receive a template; ng-template directives identify templates with a typed context. A directive shared by an entrypoint is not necessarily a slot of this component.

This component does not expose content projection or public customization templates.

Public Types

Open a type to inspect its definition and interface fields.

Theming

Mention uses theme values shared with text inputs and list surfaces.

Specific tokens

This component uses shared theme tokens rather than dedicated component hooks.

Shared tokens used

Override these on a local wrapper to affect this example. An override on :root affects other components that use the same token.

Token
Purpose here
Other impact
Default / fallback
No data