Skip to content
Alea0.1

Forms

Mentions

A text area where @ suggests people to mention.

Ant Design: Mentions

import { Mentions } from '@alea/ui';

Examples

Mentions

Type @ to mention someone.

@ suggests teammates

Props

Mentions props

A text area where @ suggests people to mention; arrows pick, Enter inserts (Ant's Mentions).

PropTypeDefaultDescription
optionsrequired{ id: string; label: string; description?: string | undefined; }[]-People or things to mention.
defaultValuestring''The text to start with.
descriptionReactNode-Help text shown under the field.
labelReactNode-The visible label.
onChange((value: string) => void)-Called with the text.
placeholderstring-Shown while there is no value.
rowsnumber3Rows of the text area. Default 3.
triggerstring'@'Character that starts a mention. Default @ .
valuestring-The text (controlled).

Accessibility

  • The text area is a combobox while suggestions show; the highlighted one is announced.

Keyboard

KeyDoes
@ then lettersSuggests
Arrow Up / DownMove
Enter or TabInsert
EscapeClose the list

Do and don't

Do

  • Show the person's handle and name in suggestions.
  • Limit suggestions to about eight.

Don't

  • Don't trigger on characters people type for other reasons.
  • Don't send notifications without telling the author.
Tested with axe, keyboard and screen reader roles