Skip to content
IndexRequest a UIAboutContact

Mention Autocomplete Menu

Type @ in a comment box to open a filtered list of people; choose with arrows and Enter, or click.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Clean UI mockup of a comment text box containing the text Thanks @ma and below it a small popup list of three people with round initials avatars and names Maya Chen, Marcus Lee and Mara Okafor, the first row highlighted, each with a small role label, light theme, soft border, flat modern style, a Post button at the bottom right. Negative: heavy shadows, clutter, text errors, device frames. Reduced motion: static design.

About this pattern

Definition

A mention menu appears when someone types @ and narrows as they keep typing. It is an accessible combobox: focus stays in the text field while arrow keys move a highlighted option, Enter inserts it and Escape closes. It saves typing exact names and avoids tagging the wrong person.

Purpose & UX principles

  • Open the list on @ at the start of a word; filter by the text after it.
  • Keep focus in the input and use aria-activedescendant to point at the active option.
  • Arrow keys move, Enter or Tab inserts, Escape closes; clicking also works.
  • Show an avatar or role to tell similar names apart, and a No matches message.

Interaction states

  • Type @ then a few letters in the comment box.

Motion specification

  • The menu appears in 120ms.
  • Reduced motion: no fade.

Responsive behaviour

  • Give the list role listbox, each option role option, and announce results count.
  • Close the menu when the cursor leaves the mention text.

Code

HTML
<div class="bx"><label class="fl" for="tx">Comment</label><div class="wr"><input id="tx" type="text" role="combobox" aria-expanded="false" aria-controls="lb" aria-autocomplete="list" autocomplete="off" placeholder="Type @ to mention someone"><ul id="lb" class="lb" role="listbox" aria-label="People" hidden></ul></div><p class="out" id="out" role="status"></p></div>

Related patterns

Command Palette

↗
Command PaletteOverlays & Dialogs

Search Input

↗
Search InputInputs & Forms

Tag Input with Chips

↗
Tag Input with ChipsInputs & Forms