Blocks / Emoji picker

Emoji picker

Search, categories, recents and a grid moved with the arrows. Emoji are user content.

import { EmojiPicker, CONVERSATION_EMOJI, searchConversationEmoji, pushRecentEmoji } from "@forgeron/ui";
/01 โ†’ Default

Chosen: none

import { EmojiPicker } from "@forgeron/ui";
import { useState } from "react";

export default function Default() {
  const [chosen, setChosen] = useState("");
  return (
    <div style={{ width: 300 }}>
      <EmojiPicker onSelect={setChosen} />
      <p style={{ font: "12px var(--font-mono)", color: "var(--ink-muted)" }}>
        Chosen: {chosen || "none"}
      </p>
    </div>
  );
}
/02 โ†’ Own set
import { EmojiPicker, type EmojiCategory } from "@forgeron/ui";

// A set of your own: the status words of a support team, as user content.
const set: EmojiCategory[] = [
  {
    id: "status",
    label: "Status",
    mark: "โœ…",
    emoji: [
      { char: "โœ…", name: "resolved" },
      { char: "๐Ÿ‘€", name: "looking" },
      { char: "โณ", name: "waiting" },
      { char: "๐Ÿšง", name: "blocked" },
    ],
  },
];

export default function OwnSet() {
  return (
    <div style={{ width: 260 }}>
      <EmojiPicker categories={set} columns={4} onSelect={() => {}} />
    </div>
  );
}
API โ†’ Props
PropTypeDefaultDescription
onSelect(emoji: string) => voidโ€”The character chosen.
categories{ id, label, mark, emoji: { char, name, keywords? }[] }[]โ€”Your own set. The built-in one is small on purpose.
recents / defaultRecents / onRecentsChangestring[]โ€”Newest first; kept by the picker unless you keep them (to store them).
columns / maxRecents / autoFocus / labelnumber; number; boolean; stringโ€”Layout and words.
classNamestringโ€”Extra classes.