SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

On this page

MentionMenu

Island suggesting people to mention while a message is written.

@ to mention

View code
tsx
<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.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
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.

@sdxc/ui

Can’t find it? Contact us