Mention Input
Introduction
Section titled “Introduction”A plain-text field that suggests people, tags, or other entities when the user types a trigger character such as @ or #. Suggestions come from an async provider you supply: calls are debounced, and every query gets its own AbortSignal, so a stale answer is never shown. Inserted mentions are kept as structured tokens { id, label, trigger, start, end } in the value, and their offsets follow every edit; editing inside a mention turns it back into plain text. Nothing is rendered as HTML. MentionInput is a Form control: it validates, serializes, and resets with Form, and native forms receive a hidden input with the JSON value.
- Structured mentionsThe value keeps each mention as { id, label, start, end }, and the offsets follow every edit.
- Async and abortableDebounced provider calls with an AbortSignal per query; stale answers are never shown.
- Several triggers@ for people, # for tags, or any character with its own provider.
- Plain text onlyNo HTML or contenteditable: the text is stored and rendered as text.
- AnnouncedResult counts, no matches, and inserted mentions are announced to screen readers.
Use it for
- Comments, notes, and messages that reference people (@) or topics (#) by id.
- Any text where the server needs to know exactly which entity was referenced, not just the typed name.
Use something else for
- Picking one or more entities without free text: use Combobox or Multi Select.
- Formatted text with bold, lists, or links: use Rich Text Editor.
- Values that must not contain free text.
Anatomy
<div class="aui-field aui-mention-input"> <label class="aui-field__label">Comment</label> <div class="aui-field__description">help</div> <textarea class="aui-mention-input__input" aria-autocomplete="list" aria-controls aria-activedescendant aria-describedby></textarea> <span class="aui-visually-hidden">Type @ for people, # for tags to mention.</span> <div class="aui-field__counter">480 characters remaining</div> <div class="aui-field__error">error</div> <div class="aui-mention-input__popup" popover="manual"> (top layer while open) <ul class="aui-mention-input__list" role="listbox" aria-label="Suggestions"> <li class="aui-mention-input__option" role="option" aria-selected>@Ana <span>People team</span></li> </ul> <div class="aui-mention-input__status">Searching… | No matches</div> </div> <input type="hidden" name="comment" value='{"text":"…","mentions":[…]}'></div>Live example
Section titled “Live example”Use the bar above each frame to switch theme, density, direction, and locale.
Mention Input in the Personal preferences showcase
Section titled “Mention Input in the Personal preferences showcase”The part of the Personal preferences showcase that uses Mention Input. Change its options, use it with the keyboard, and watch the event log; the link in the frame opens the full showcase. The bar above the frame switches theme, density, direction, and locale.
Showcase source
// Preferences showcase: a personal settings page with the new form controls. An accent// color with swatches, a contrast hint, and the eyedropper where supported; a satisfaction rating// with half steps; team assignment between two searchable lists (with drag); a work location// cascader whose cities load from a simulated server; a mention comment box with @people and// #tags from a simulated directory; a masked phone number; and an acknowledgement signature.import { Cascader, type CascaderOption, type CascaderValue } from '@absoluteui/components/cascader';import { ColorPicker } from '@absoluteui/components/color-picker';import { MaskedInput, MASK_PRESETS } from '@absoluteui/components/masked-input';import { MentionInput, type MentionSuggestion } from '@absoluteui/components/mention-input';import { Rating } from '@absoluteui/components/rating';import { SignaturePad } from '@absoluteui/components/signature-pad';import { TransferList, type TransferListItem } from '@absoluteui/components/transfer-list';import { action, choice, createShowcase, hostIn, section, status, toggle, wait } from './kit.js';
const sc = createShowcase({ title: 'Personal preferences', description: 'Pick an accent color, rate onboarding, choose your team and location, leave a comment with mentions, and sign.', simulated: true,});
// Appearance: color.const appearance = section(sc, 'Appearance', ['color-picker']);const color = ColorPicker.create(hostIn(appearance), { label: 'Accent color', description: 'Used for your calendar entries and highlights.', value: '#2563eb', presets: [ { value: '#2563eb', label: 'Blue' }, { value: '#15803d', label: 'Green' }, { value: '#b45309', label: 'Amber' }, { value: '#b91c1c', label: 'Red' }, { value: '#7c3aed', label: 'Violet' }, ], recent: ['#0f766e', '#be185d'], contrastWith: '#ffffff', name: 'accent',});sc.listen(color.host, ['aui-change'], 'color');
// Feedback: rating.const feedback = section(sc, 'Feedback', ['rating']);const rating = Rating.create(hostIn(feedback), { label: 'How was your onboarding?', allowHalf: true, value: 4, labels: ['Poor', 'Fair', 'Good', 'Very good', 'Excellent'], name: 'onboarding',});sc.listen(rating.host, ['aui-change'], 'rating');Rating.create(hostIn(feedback), { label: 'Team average', value: 4.5, allowHalf: true, display: true, size: 'sm' });
// Team: transfer list over a realistic directory size.const team = section(sc, 'Team', ['transfer-list']);const FIRST = ['Ana', 'Ben', 'Chen', 'Divya', 'Elif', 'Farah', 'Goran', 'Hana', 'Ivan', 'Jun', 'Kofi', 'Lena', 'Mateo', 'Nora', 'Omar', 'Priya'];const LAST = ['Ruiz', 'Okafor', 'Wang', 'Iyer', 'Kaya', 'Haddad', 'Petrov', 'Sato', 'Novak', 'Kim', 'Mensah', 'Fischer', 'Silva', 'Berg', 'Aziz', 'Rao'];const people: TransferListItem[] = [];for (let i = 0; i < 240; i++) { const name = `${FIRST[i % FIRST.length] ?? ''} ${LAST[Math.floor(i / FIRST.length) % LAST.length] ?? ''}`; people.push({ value: `p${String(i)}`, label: name, description: ['Engineering', 'Finance', 'People', 'Sales'][i % 4] ?? '', ...(i % 37 === 5 ? { disabled: true } : {}) });}const transfer = TransferList.create(hostIn(team), { label: 'Project team', items: people, value: ['p1', 'p2'], draggable: true, maxSelected: 12, name: 'team' });sc.listen(transfer.host, ['aui-change'], 'team');
// Location: lazy cascader.const location = section(sc, 'Work location', ['cascader']);const CITIES: Record<string, string[]> = { 'de/by': ['Munich', 'Nuremberg', 'Augsburg'], 'de/be': ['Berlin'], 'in/ka': ['Bengaluru', 'Mysuru'], 'in/mh': ['Mumbai', 'Pune'], 'us/ca': ['San Francisco', 'Los Angeles', 'San Diego'], 'us/ny': ['New York', 'Buffalo'],};const places: CascaderOption[] = [ { value: 'de', label: 'Germany', children: [{ value: 'by', label: 'Bavaria' }, { value: 'be', label: 'Berlin' }] }, { value: 'in', label: 'India', children: [{ value: 'ka', label: 'Karnataka' }, { value: 'mh', label: 'Maharashtra' }] }, { value: 'us', label: 'United States', children: [{ value: 'ca', label: 'California' }, { value: 'ny', label: 'New York' }] },];const cascader = Cascader.create(hostIn(location), { label: 'Office', options: places, value: ['de', 'by', 'munich'], levelLabels: ['Country', 'State', 'City'], name: 'office', loadChildren: async (_option, { signal, path }) => { await wait(500, signal); sc.log('server answered', { path }); return (CITIES[path.join('/')] ?? []).map((city) => ({ value: city.toLowerCase().replace(/\s+/g, '-'), label: city, isLeaf: true })); },});sc.listen(cascader.host, ['aui-change'], 'cascader');
// Comment: mentions from a simulated directory.const comment = section(sc, 'Comment', ['mention-input']);const TAGS = ['onboarding', 'payroll', 'benefits', 'equipment', 'training'];const findPeople = async (query: string, signal: AbortSignal): Promise<MentionSuggestion[]> => { await wait(250, signal); const q = query.toLowerCase(); return people.filter((p) => p.label.toLowerCase().includes(q)).slice(0, 8).map((p) => ({ id: p.value, label: p.label, description: p.description ?? '' }));};const mention = MentionInput.create(hostIn(comment), { label: 'Note for your manager', description: 'Type @ to mention a colleague or # to add a topic.', maxLength: 500, showCounter: true, name: 'note', triggers: [ { char: '@', label: '@ for people', provider: (query, { signal }) => findPeople(query, signal) }, { char: '#', label: '# for topics', provider: async (query, { signal }) => { await wait(150, signal); return TAGS.filter((t) => t.startsWith(query.toLowerCase())).map((t) => ({ id: t, label: t })); } }, ],});sc.listen(mention.host, ['aui-change', 'aui-mention'], 'mention');
// Contact: masked phone number.const contact = section(sc, 'Contact', ['masked-input']);const phone = MaskedInput.create(hostIn(contact), { label: 'Mobile phone', name: 'phone', ...MASK_PRESETS.phoneUs });sc.listen(phone.host, ['aui-change'], 'phone');
// Acknowledgement: signature.const sign = section(sc, 'Acknowledgement', ['signature-pad']);const signature = SignaturePad.create(hostIn(sign), { label: 'Signature', description: 'Draw your signature, or choose Type to enter your full name.', required: true, name: 'signature' });sc.listen(signature.host, ['aui-change'], 'signature');const summary = status(sign);const summarize = (): void => { const v = signature.value; summary.textContent = v === null ? 'Not signed yet.' : v.mode === 'type' ? `Signed as ${v.text}.` : `Signed with ${String(v.strokes.length)} strokes.`;};signature.host.addEventListener('aui-change', summarize);summarize();
// Options.const controls = [color, rating, transfer, cascader, mention, phone, signature];toggle(sc, 'Disabled', false, (disabled) => { for (const c of controls) c.update({ disabled });});toggle(sc, 'Read-only', false, (readOnly) => { for (const c of controls) c.update({ readOnly });});choice( sc, 'Color picker', [ { value: 'popup', label: 'Popup' }, { value: 'inline', label: 'Inline' }, ], 'popup', (mode) => { color.update({ mode }); }, ['color-picker'],);toggle(sc, 'Half stars', true, (allowHalf) => { rating.update({ allowHalf });}, ['rating']);/** A single path (strings), as opposed to a list of paths. */const isPath = (v: CascaderValue): v is readonly string[] => v?.every((part) => typeof part === 'string') === true;toggle(sc, 'Several offices', false, (multiple) => { const current = cascader.value; cascader.update({ multiple, value: multiple ? (isPath(current) ? [current] : []) : null });}, ['cascader']);action(sc, 'Validate', () => { const invalid = controls.filter((c) => !c.reportValidity()); sc.log('validate', { invalid: invalid.map((c) => c.label) });});action(sc, 'Reset', () => { for (const c of controls) c.reset(); summarize(); sc.log('reset');});Comment with people and tags
Section titled “Comment with people and tags”import { MentionInput, type MentionSuggestion, type MentionInputValueDetail } from '@absoluteui/components/mention-input';
const people: MentionSuggestion[] = [ { id: 'u1', label: 'Ana', description: 'People team' }, { id: 'u2', label: 'Ben', description: 'Engineering' },];const tags: MentionSuggestion[] = [{ id: 't1', label: 'onboarding' }, { id: 't2', label: 'payroll' }];const match = (list: MentionSuggestion[], query: string): MentionSuggestion[] => list.filter((s) => s.label.toLowerCase().startsWith(query.toLowerCase()));
const host = document.createElement('div');document.body.append(host);MentionInput.create(host, { label: 'Comment', maxLength: 500, showCounter: true, triggers: [ { char: '@', label: '@ for people', provider: async (query) => match(people, query) }, { char: '#', label: '# for tags', provider: async (query) => match(tags, query) }, ],});host.addEventListener('aui-change', (event) => { const { value } = (event as CustomEvent<MentionInputValueDetail>).detail; console.log(value.text, value.mentions.map((m) => m.id));});Server provider with abort
Section titled “Server provider with abort”import { MentionInput, type MentionSuggestion } from '@absoluteui/components/mention-input';
const host = document.createElement('div');document.body.append(host);MentionInput.create(host, { label: 'Note', debounce: 250, triggers: [ { char: '@', minChars: 1, provider: async (query, { signal }) => { const response = await fetch(`/api/people?q=${encodeURIComponent(query)}`, { signal }); return (await response.json()) as MentionSuggestion[]; }, }, ],});Initial value with a mention
Section titled “Initial value with a mention”import { MentionInput } from '@absoluteui/components/mention-input';
const host = document.createElement('div');document.body.append(host);const field = MentionInput.create(host, { label: 'Handover note', multiline: false, value: { text: 'Ask @Ana about access', mentions: [{ id: 'u1', label: 'Ana', trigger: '@', start: 4, end: 8 }] }, triggers: [{ char: '@', provider: async () => [] }],});console.log(field.value.mentions[0]?.id);Install and start
Section titled “Install and start”npm install @absoluteui/components @absoluteui/core @absoluteui/themeRegistry setup, the theme stylesheet, and the Content Security Policy are covered in Installation.
import { MentionInput } from '@absoluteui/components/mention-input';import '@absoluteui/components/mention-input/style.css';First use
Section titled “First use”import { MentionInput } from '@absoluteui/components/mention-input';import '@absoluteui/components/mention-input/style.css';
const host = document.querySelector<HTMLElement>('#note');if (host) { MentionInput.create(host, { label: 'Note', name: 'note', triggers: [{ char: '#', label: '# for tags', provider: (query) => Promise.resolve([{ id: 'payroll', label: 'payroll' }].filter((t) => t.label.startsWith(query))) }], });}More usage
import { MentionInput, type MentionSuggestion } from '@absoluteui/components/mention-input';
const people: MentionSuggestion[] = [{ id: 'u1', label: 'Ana', description: 'People team' }, { id: 'u2', label: 'Ben' }];const host = document.querySelector<HTMLElement>('#comment');if (host) { MentionInput.create(host, { label: 'Comment', triggers: [{ char: '@', label: '@ for people', provider: (query) => Promise.resolve(people.filter((p) => p.label.toLowerCase().startsWith(query.toLowerCase()))) }], });}Using Angular? See Mention Input for Angular.
API reference
Section titled “API reference”Factory
Section titled “Factory”MentionInput.create(host: HTMLElement, options: MentionInputOptions): MentionInputGlobal configuration key: mentionInput (see Configuration).
Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
label |
string |
Visible label and accessible name. Required. | |
hideLabel |
boolean |
false |
Visually hide the label; it remains the accessible name. |
description |
string |
Help text referenced by aria-describedby. | |
placeholder |
string |
Supplementary hint; never replaces the label. | |
triggers |
readonly MentionTrigger[] |
Trigger characters with their async providers: { char, provider(query, { signal, trigger }), label?, minChars? }. Required. | |
value |
MentionInputValue | string |
"''" |
Initial value: plain text or { text, mentions }; also restored by reset(). |
name |
string |
Form field name; the hidden input carries the JSON value. | |
required |
boolean |
false |
Empty text is invalid; shows the required indicator. |
disabled |
boolean |
false |
Disables the field. |
readOnly |
boolean |
false |
Focusable and submitted, not editable; no suggestions. |
multiline |
boolean |
true |
true: a textarea; false: a single-line input with the combobox role. Set at creation only. |
rows |
number |
3 |
Visible rows of the textarea. |
maxLength |
number |
Maximum length in code points (validated, not truncated). | |
showCounter |
boolean |
false |
Show remaining/over characters; requires maxLength. |
validate |
(value: MentionInputValue) => string | null |
Consumer validation; return a message to mark the value invalid. | |
icons |
Partial<{ error: IconRef }> |
Icon slot overrides. | |
validationTiming |
'blur' | 'input' | 'submit' |
"blur" |
When validation messages first appear; afterwards they update live. Globally configurable. |
debounce |
number |
200 |
Milliseconds between the last keystroke and the provider call (0 to 5000). Globally configurable. |
maxSuggestions |
number |
8 |
Most suggestions shown at once (1 to 50). Globally configurable. |
locale |
string |
"en-US" |
Message and number-formatting locale. Globally configurable. Inherited from common configuration. |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
host |
HTMLElement |
Consumer host; its children are owned by the component. |
input |
HTMLTextAreaElement | HTMLInputElement |
The native field. |
value |
MentionInputValue |
{ text, mentions }, mentions sorted by start. |
expanded |
boolean |
Whether the suggestion list is open. |
name |
string | null |
Form field name. |
label |
string |
Label text. |
disabled |
boolean |
Disabled state. |
validity |
FieldValidity |
{ valid, error, message }; computed on every change. |
dirty |
boolean |
Value differs from the initial value. |
touched |
boolean |
Focus has left the control at least once. |
options |
Readonly<MentionInputOptions> |
Current instance options. |
Methods
Section titled “Methods”| Method | Description |
|---|---|
setValue(value: MentionInputValue | string): void |
Programmatic value (no events); a string clears the mentions; mismatched mentions throw. |
update(options: Partial<MentionInputOptions>): void |
Merge and apply options (multiline is fixed at creation). |
reportValidity(): boolean |
Show messages now and return validity. |
setCustomError(message: string | null): void |
External error; cleared when the user edits. |
getFormValue(): MentionInputValue |
Value for form serialization. |
focus(): void |
Focus the field. |
reset(): void |
Restore the initial value and clear dirty/touched/submitted state. |
destroy(): void |
Remove rendering, listeners, pending queries, registration, and subscriptions. |
Events
Section titled “Events”| Event | Detail | Bubbles | Cancelable | Description |
|---|---|---|---|---|
aui-input |
MentionInputValueDetail |
Yes | No | The text or mentions changed: { value, validity }. |
aui-change |
MentionInputValueDetail |
Yes | No | Committed: a mention was inserted, or focus left with a changed value. |
aui-mention |
MentionInputMentionDetail |
Yes | No | A suggestion was inserted: { mention }. |
CSS classes
Section titled “CSS classes”All rules live in the aui.components cascade layer, so application styles override them without specificity battles.
| Class | Purpose |
|---|---|
aui-field aui-mention-input |
Host. |
aui-mention-input--invalid | --disabled |
State modifiers on the host. |
aui-field__label | __required | __description | __counter | __error |
Shared field chrome. |
aui-mention-input__input |
Native textarea or input. |
aui-mention-input__popup |
Top-layer suggestion popup. |
aui-mention-input__list |
Suggestion listbox. |
aui-mention-input__option | __option--active |
A suggestion and the active suggestion. |
aui-mention-input__option-label | __option-description |
Suggestion texts. |
aui-mention-input__status |
Loading, no matches, or failure text. |
Icon slots
Section titled “Icon slots”| Slot | Default icon |
|---|---|
error |
alert-circle |
Design tokens
Section titled “Design tokens”Tokens this stylesheet reads (verified in CI). Override them in a theme or with the Theme Designer.
--aui-border-width | --aui-color-border | --aui-color-border-strong | --aui-color-disabled-bg | --aui-color-error-fg | --aui-color-focus-ring | --aui-color-hover | --aui-color-selected | --aui-color-selected-text | --aui-color-surface | --aui-color-surface-sunken | --aui-color-text | --aui-color-text-disabled | --aui-color-text-muted | --aui-control-height-md | --aui-control-height-sm | --aui-control-padding-x | --aui-duration-fast | --aui-easing-standard | --aui-focus-ring-width | --aui-font-family-sans | --aui-font-size-md | --aui-font-size-sm | --aui-font-weight-medium | --aui-icon-size-sm | --aui-line-height-normal | --aui-line-height-tight | --aui-popover-max-height | --aui-radius-md | --aui-radius-sm | --aui-shadow-md | --aui-space-1 | --aui-space-2 | --aui-space-3
TypeScript definitions
interface MentionSuggestion { readonly id: string; readonly label: string; readonly description?: string }type MentionProvider = (query: string, context: { readonly signal: AbortSignal; readonly trigger: string }) => Promise<readonly MentionSuggestion[]>;interface MentionTrigger { readonly char: string; readonly provider: MentionProvider; readonly label?: string; readonly minChars?: number }interface MentionToken { readonly id: string; readonly label: string; readonly trigger: string; readonly start: number; readonly end: number }interface MentionInputValue { readonly text: string; readonly mentions: readonly MentionToken[] }interface MentionInputConfig { validationTiming: 'blur' | 'input' | 'submit'; debounce: number; maxSuggestions: number }interface MentionInputOptions extends Partial<MentionInputConfig> { label: string; hideLabel?: boolean; description?: string; placeholder?: string; value?: MentionInputValue | string; name?: string; required?: boolean; disabled?: boolean; readOnly?: boolean; multiline?: boolean; rows?: number; maxLength?: number; showCounter?: boolean; triggers: readonly MentionTrigger[]; validate?: (value: MentionInputValue) => string | null; locale?: string; icons?: Partial<{ error: IconRef }>;}interface MentionInputValueDetail { value: MentionInputValue; validity: FieldValidity }interface MentionInputMentionDetail { mention: MentionToken }Accessibility and performance
Section titled “Accessibility and performance”Accessibility
Section titled “Accessibility”Pattern: WAI-ARIA APG Combobox with a listbox popup (list autocomplete). The single-line field is role=combobox with aria-expanded; the textarea keeps its native textbox role (ARIA does not allow combobox on textarea) and exposes aria-autocomplete, aria-controls, and aria-activedescendant.
Checked on every docs build: the showcase passes axe (WCAG 2.2 A and AA rules) in the default, dark, and high-contrast themes and right to left; the playground loads without errors and passes axe before and after every on/off option is switched, with no Content Security Policy violations.
Keyboard
Section titled “Keyboard”| Key | Context | Action |
|---|---|---|
| Trigger character (for example @) | Field | Opens suggestions for the text typed after it. |
| ArrowDown / ArrowUp | Suggestions open | Moves the active suggestion (wraps). |
| Enter / Tab | Suggestions open | Inserts the active suggestion as a mention followed by a space. |
| Escape | Suggestions open | Closes the suggestions until the caret leaves this trigger. |
| Space | Suggestions open | Ends the query; the suggestions close. |
| Any other key | Field | Native text editing; mentions the edit touches become plain text. |
| Element | Role |
|---|---|
| single-line field | combobox |
| textarea | textbox (native, multiline) |
| suggestion list | listbox |
| suggestion | option |
ARIA attributes
Section titled “ARIA attributes”| Attribute | Element | Value |
|---|---|---|
aria-autocomplete |
field | list |
aria-expanded |
single-line field | true while suggestions are open |
aria-controls |
field | the listbox id while open |
aria-activedescendant |
field | the active suggestion while open |
aria-selected |
suggestion | true on the active suggestion |
aria-label |
listbox | Suggestions (localized) |
aria-describedby |
field | help text, counter, error, and the trigger hint (‘Type @ for people to mention.’) |
aria-invalid |
field | true while an error is shown |
aria-busy |
popup | true while the provider is loading |
Focus stays in the field; suggestions are referenced with aria-activedescendant, and pointer selection does not move focus.
WCAG 2.2 success criteria addressed
Section titled “WCAG 2.2 success criteria addressed”| Criterion | Level | Note |
|---|---|---|
| 1.3.1 Info and Relationships | A | |
| 2.1.1 Keyboard | A | |
| 2.4.7 Focus Visible | AA | |
| 3.3.1 Error Identification | A | |
| 3.3.2 Labels or Instructions | A | |
| 4.1.2 Name, Role, Value | A | |
| 4.1.3 Status Messages | AA |
Automated test results: Accessibility and compliance.
Notes and known caveats
Section titled “Notes and known caveats”- Result counts, ‘No matches’, failures, and inserted mentions are announced through a polite live region (4.1.3).
- The trigger hint is part of the description, so screen-reader users learn that @ or # open suggestions.
- Mentions are plain text in the field; the structure lives in the value.
- Manual screen-reader verification (NVDA, JAWS, VoiceOver) is pending.
- Some screen readers announce aria-activedescendant changes on a textarea less reliably than on a combobox; the polite count announcement compensates.
Performance
Section titled “Performance”| Import cost | Minified | gzip | brotli | CSS brotli |
|---|---|---|---|---|
@absoluteui/components/mention-input |
55.2 kB | 18.7 kB | 16.6 kB | 1.1 kB |
Measured at build time, including every AbsoluteUI module the component pulls in. No third-party runtime dependencies.
| Budget (enforced in CI) | Limit |
|---|---|
| MentionInput.create, per instance | < 3 ms average in headless Chromium |
| Offset update per edit | O(mentions) with one string diff |
Tested scale: Texts of 10,000 characters with 200 mentions; up to 50 suggestions shown (maxSuggestions).
Each edit runs one string diff (resolved with the caret position) and one pass over the mentions. Provider calls are debounced and at most one is in flight.
Measured run times: Performance.
Details
Section titled “Details”States
Empty; filled; suggestions open; loading; no matches; provider failed; single-line or multiline; required; disabled; read-only; invalid; counter over the limit.
State transitions
| From | Trigger | To |
|---|---|---|
| closed | a trigger character typed at the start or after whitespace | open, “Searching…”; the provider is called after debounce ms |
| open | more characters typed | the previous query is aborted; a new one starts |
| open | provider answers | suggestions listed (first active) or “No matches”; the count is announced |
| open | provider rejects | “Suggestions could not be loaded.” (announced) |
| open | Enter, Tab, or a click on a suggestion | mention inserted with a trailing space; aui-input, aui-mention, aui-change |
| open | Escape, whitespace, caret leaves the trigger, focus leaves | closed (pending query aborted) |
| mention | an edit inside its text | the mention becomes plain text |
| any | focus leaves with a changed value | aui-change |
Accessibility notes
- Counts (“3 suggestions”), “No matches”, failures, and inserted mentions (“Ana mentioned”) are announced politely (WCAG 4.1.3).
- Give each trigger a
labelsuch as “@ for people” so the hint is meaningful. - Pointer selection does not move focus from the field.
- The e2e axe run covers three themes; manual screen-reader verification is pending.
Responsive behavior
The field fills its container. The popup is at most 24rem wide (and never wider than the viewport) and flips above the field when there is no room below.
Right-to-left
Text follows the document direction; the popup aligns with the field’s inline start.
Theming
Colors come from global tokens in all three themes. Forced colors: the active suggestion uses Highlight and HighlightText, the popup border CanvasText.
Global configuration
configureAbsoluteUI({ components: { mentionInput: { debounce: 300, maxSuggestions: 10, validationTiming: 'input' } } });Component configuration
Instance validationTiming, debounce, maxSuggestions, and locale override configuration; configuration changes re-render existing fields.
Icons
icons.error (default alert-circle) for the validation message.
Security
The field is a native textarea or input; labels, descriptions, and statuses use textContent. Provider results are validated (id and label must be strings) before they are shown. The value is plain text with offsets, never HTML, so it can be stored and rendered as text without sanitizing; if you render mentions as links later, build the elements yourself from the tokens.
Data handling
The provider receives the query and an AbortSignal; nothing is stored or sent elsewhere. Superseded queries are aborted, and late answers are ignored even when the provider ignores the signal.
Supported data scale
Texts of 10,000 characters with 200 mentions; up to 50 suggestions shown at once (maxSuggestions). Filter large directories on the server.
Edge cases
- A trigger counts only at the start of the text or after whitespace, so
ana@example.comdoes not open suggestions. - Typing directly after a mention (no space) keeps the mention; typing or deleting inside it removes the token and keeps the text.
- When the text after the caret already starts with a space, no second space is inserted.
- Offsets are UTF-16 indices (the same as
selectionStart), so emoji in the text are counted as the browser counts them. setValue({ text, mentions })throws when a mention’s text range does not equaltrigger + labelor mentions overlap.
Errors
| Code | Category | Cause |
|---|---|---|
MENTION_INPUT_OPTIONS |
configuration | Blank label, no triggers, a trigger char that is not a single non-space character or is repeated, a provider that is not a function, invalid minChars, rows, or maxLength, showCounter without maxLength, a value whose mentions do not match its text, or changing multiline after creation. |
CFG_INVALID_VALUE / CFG_UNKNOWN_OPTION |
configuration | Invalid configuration. |
A rejected provider shows “Suggestions could not be loaded.” and never throws. Invalid options throw before the host is modified.
Known limitations
- Mentions are not highlighted inside the field (a native textarea cannot style ranges).
- Inserting a suggestion is not part of the browser’s undo history.
- Queries stop at whitespace; multi-word labels are found by their first word.
- Manual screen-reader verification is pending.
Unsupported scenarios
- Rich text, HTML, or Markdown rendering.
- Mentions without a trigger character.
(c) 2026 Kasadara Technology Solutions Pvt Ltd. AbsoluteUI is free to use under the AbsoluteUI Free Use License; it is not open source.