MentionMenu
Island suggesting people to mention while a message is written.
View code
<Composer method="post" action="/channels/general/messages">
<Composer.Input name="body" aria-label="Message #general" placeholder="Message #general" />
<MentionMenu
people={[
{ id: "1", handle: "ana", name: "Ana Lima", detail: "Design", initials: "AL", color: "#7c3aed" },
{ id: "2", handle: "marco", name: "Marco Díaz", detail: "Backend", initials: "MD", color: "#0891b2" },
]}
labels={{ list: "People", empty: "Nobody matches" }}
/>
<Composer.Toolbar>
<Composer.Hint>
<Keyboard>@</Keyboard> to mention
</Composer.Hint>
<ComposerSubmit labels={{ send: "Send message", stop: "Stop" }} />
</Composer.Toolbar>
</Composer>Installation
An ordinary dependency: install it, import the theme once, and import the component where it is used.
npm add @sdxc/ui remiximport "@sdxc/ui/theme.css";Usage
import { MentionMenu } from "@sdxc/ui/chat";Renders the list as a manual popover anchored above the composer. While it is open the field acts as its combobox: ArrowUp and ArrowDown move, Enter or Tab writes the active person's handle, Escape closes, and Enter never sends the message.
Props
Read from the component's own types, so every prop, every default and every allowed value is listed.