Forms
Mentions
A text area where @ suggests people to mention.
Ant Design: Mentions
import { Mentions } from '@alea/ui';
Examples
Mentions
Type @ to mention someone.
Props
Mentions props
A text area where @ suggests people to mention; arrows pick, Enter inserts (Ant's Mentions).
| Prop | Type | Default | Description |
|---|---|---|---|
optionsrequired | { id: string; label: string; description?: string | undefined; }[] | - | People or things to mention. |
defaultValue | string | '' | The text to start with. |
description | ReactNode | - | Help text shown under the field. |
label | ReactNode | - | The visible label. |
onChange | ((value: string) => void) | - | Called with the text. |
placeholder | string | - | Shown while there is no value. |
rows | number | 3 | Rows of the text area. Default 3. |
trigger | string | '@' | Character that starts a mention. Default @ . |
value | string | - | The text (controlled). |
Accessibility
- The text area is a combobox while suggestions show; the highlighted one is announced.
Keyboard
| Key | Does |
|---|---|
| @ then letters | Suggests |
| Arrow Up / Down | Move |
| Enter or Tab | Insert |
| Escape | Close 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.