@ferrucc-io/emoji-picker

中文文档
0.1.2发布于 2026/08/18MITTypeScriptESM + CJS构建来源已验证近 30 天下载 17.3万

A beautiful and modern emoji picker for React

原始使用文档
文档目录16 节
  1. Live Demo
  2. Features
  3. Installation
  4. Default Style
  5. Props & Customization
  6. Custom Emojis
  7. Custom Section Headers
  8. Examples
  9. Linear Style
  10. Slack Style
  11. Used by
  12. Credits
  13. Contributing
  14. Development Setup
  15. Updating Emoji Colors
  16. Testing

Emoji Picker

A composable React emoji picker component with Tailwind styling

npm version npm downloads License

Emojicn Demo

Features

  • 🎨 Unstyled & Composable: Built with Tailwind CSS. Every component is minimally styled by default and fully customizable.
  • ⚡️ Fast & Lightweight: Virtualized list for smooth scrolling. Only renders emojis in view.
  • 🎯 Accessible: Full keyboard and screen reader navigation support.
  • 🛜 No external CDNs: All emoji data is included as part of this dependency no external CDNs.
  • 🔣 No � symbols: Unsupported emojis are automatically hidden
  • 🌈 Dominant Color Hover: Built-in dominant color hover for supported emojis.
  • 🖼️ Custom Emojis: Add your own image-based emoji sections (like Slack custom emojis) and a frequently used section.

Installation

To use this component your project must be using React and Tailwind.

To install the component:

bun add @ferrucc-io/emoji-picker
# or
yarn add @ferrucc-io/emoji-picker
# or
npm i @ferrucc-io/emoji-picker
# or
pnpm add @ferrucc-io/emoji-picker

Then in your project you can use the component like this:

<EmojiPicker onEmojiSelect={handleEmojiSelect}>
  <EmojiPicker.Header>
    <EmojiPicker.Input placeholder="Search emoji" />
  </EmojiPicker.Header>
  <EmojiPicker.Group>
    <EmojiPicker.List />
  </EmojiPicker.Group>
</EmojiPicker>

Finally, import the component styles in your Tailwind configuration:

// If you're using Tailwind v4.x
// In your CSS file containing your tailwind configuration
// Add this line:
@source "../node_modules/@ferrucc-io/emoji-picker";

// If you're using Tailwind v3.x
// In your tailwind.config.ts
"content": [
  // Keep the existing content array
  // Add this line:
  "./node_modules/@ferrucc-io/emoji-picker/dist/**/*.{js,jsx,ts,tsx}",
],

Default Style

<EmojiPicker onEmojiSelect={handleEmojiSelect}>
  <EmojiPicker.Header>
    <EmojiPicker.Input placeholder="Search emoji" />
  </EmojiPicker.Header>
  <EmojiPicker.Group>
    <EmojiPicker.List />
  </EmojiPicker.Group>
</EmojiPicker>

Props & Customization

The base component accepts several props for customization:

interface EmojiPickerProps {
  emojisPerRow?: number;      // Number of emojis per row
  emojiSize?: number;         // Size of each emoji in pixels
  containerHeight?: number;    // Height of the emoji container
  maxUnicodeVersion?: number; // Maximum Unicode version to include (defaults to 16.0, matching unicode-emoji-json package). Hides unsupported emojis that render as � on the user's system
  onEmojiSelect?: (emoji: string) => void; // Callback when emoji is selected
  customSections?: CustomSection[]; // Custom image-based emoji sections to show alongside the standard categories
  frequentlyUsedEmojis?: (string | CustomEmoji)[]; // Emojis to show in a "Frequently Used" section at the top
  renderHeader?: (props: HeaderRendererProps) => React.ReactNode; // Custom renderer for section headers
}

Custom Emojis

You can add your own image-based emojis (like Slack custom emojis) via the customSections prop, and pin a "Frequently Used" section at the top of the list with frequentlyUsedEmojis:

import { EmojiPicker } from '@ferrucc-io/emoji-picker';
import type { CustomEmoji, CustomSection } from '@ferrucc-io/emoji-picker';

const customSections: CustomSection[] = [
  {
    id: 'custom',
    name: 'Custom',
    priority: 1, // Lower values appear first (defaults to 999)
    emojis: [
      { id: 'mic-drop', name: 'mic-drop', imageUrl: '/custom-emojis/mic-drop.gif' },
      { id: 'shipitparrot', name: 'shipitparrot', imageUrl: '/custom-emojis/shipitparrot.gif' },
    ],
  },
];

// Mix standard emoji strings and custom emoji objects
const frequentlyUsedEmojis: (string | CustomEmoji)[] = [
  '👍',
  '❤️',
  { id: 'thisisfine', name: 'thisisfine', imageUrl: '/custom-emojis/thisisfine.gif' },
];

<EmojiPicker
  customSections={customSections}
  frequentlyUsedEmojis={frequentlyUsedEmojis}
  onEmojiSelect={(emoji) => {
    // Standard emojis: the emoji character, e.g. "👍"
    // Custom emojis: the name wrapped in colons, e.g. ":mic-drop:"
    console.log(emoji);
  }}
>
  {/* ... */}
</EmojiPicker>

Custom emojis are searchable by name, support full keyboard navigation, and show up in the preview just like standard emojis.

The relevant types are exported from the package, along with an isCustomEmoji type guard:

interface CustomEmoji {
  id: string;
  name: string;
  imageUrl: string;
  category?: string;
}

interface CustomSection {
  id: string;
  name: string;
  emojis: (EmojiMetadata | CustomEmoji)[];
  priority?: number; // Lower values appear first (defaults to 999)
}

Custom Section Headers

Use the renderHeader prop to take full control of how section headers are rendered:

import type { HeaderRendererProps } from '@ferrucc-io/emoji-picker';

function MyHeader({ content, isSticky }: HeaderRendererProps) {
  return (
    <div className={isSticky ? 'bg-white/95 backdrop-blur-sm' : 'bg-transparent'}>
      {content}
    </div>
  );
}

<EmojiPicker renderHeader={MyHeader}>
  {/* ... */}
</EmojiPicker>

Examples

The main idea behind the component is to be able to support as many different styles as possible. The first version we made supports building a picker that looks like the ones in Slack and Linear.

In the future it would be great to support more styles like the ones in Discord, Whatsapp, Notion etc.

Linear Style

<EmojiPicker
  className="border border-zinc-200 dark:border-zinc-800 rounded-lg"
  emojisPerRow={12}
  emojiSize={28}
  onEmojiSelect={onEmojiSelect}
>
  <EmojiPicker.Header className="p-2 pb-0">
    <EmojiPicker.Input
      placeholder="Search emoji"
      autoFocus={true}
      className="focus:ring-2 focus:ring-inset ring-1 ring-transparent"
    />
  </EmojiPicker.Header>
  <EmojiPicker.Group>
    <EmojiPicker.List hideStickyHeader={true} containerHeight={400} />
  </EmojiPicker.Group>
</EmojiPicker>

Slack Style

<EmojiPicker 
  className="font-['Lato'] w-[380px] border-none"
  emojisPerRow={9}
  emojiSize={36}
>
  <EmojiPicker.Header>
    <EmojiPicker.Input 
      placeholder="Search all emoji" 
      className="h-[36px] bg-white dark:bg-zinc-800 border border-zinc-300 dark:border-zinc-600 w-full rounded-[8px] text-[15px] focus:shadow-[0_0_0_1px_#1d9bd1,0_0_0_6px_rgba(29,155,209,0.3)] dark:focus:shadow-[0_0_0_1px_#1d9bd1,0_0_0_6px_rgba(29,155,209,0.3)] focus:border-transparent focus:outline-none mb-1"
      hideIcon
    />
  </EmojiPicker.Header>
  <EmojiPicker.Group>
    <EmojiPicker.List containerHeight={320} />          
  </EmojiPicker.Group>
  <EmojiPicker.Preview>
    {({ previewedEmoji }) => (
      <>
        {previewedEmoji ? 
          <EmojiPicker.Content />
          :
          <button>Add Emoji</button>
        }
        <EmojiPicker.SkinTone />
      </>
    )}
  </EmojiPicker.Preview>
</EmojiPicker>

Used by

This project is currently used by:

  • June - An analytics product for B2B SaaS
  • Langfuse - Traces, evals, prompt management and metrics to debug and improve your LLM application.
  • Typefully - The writing app for X, LinkedIn, Threads and more

Feel free to open a PR to add your name here if you're using the component in your project.

Credits

This project was created using bun init in bun v1.2.0. Bun is a fast all-in-one JavaScript runtime.

Contributing

This project is structured as a monorepo with two main parts:

  • packages/emoji-picker: The main package containing the emoji picker component
  • demo: A demo application showcasing different uses of the component

Development Setup

To get started with development:

# Install dependencies for all packages
bun install

# Run the development server
bun dev

Updating Emoji Colors

To update the emoji hover colors:

cd packages/emoji-picker
bun run build:emoji-colors

This will generate a new emojiColors.ts file in the package's src/utils directory.

Testing

# Run tests for the emoji picker package
cd packages/emoji-picker
bun test

Contributions are welcome! Please feel free to submit a PR.

版本与发布记录

@ferrucc-io/emoji-picker 共发布 46 个版本,首次发布于 2025/01/25;过去 12 个月发布了 4 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.1.2latest2026/08/182 个月前
0.1.12026/06/085 个月前
0.0.482025/11/1711 个月前
0.0.492025/11/1711 个月前
0.0.472025/10/121.1 年前
0.0.462025/10/121.1 年前

关于 @ferrucc-io/emoji-picker 的常见问题

@ferrucc-io/emoji-picker 是什么?

A beautiful and modern emoji picker for React

如何安装 @ferrucc-io/emoji-picker?

在项目目录运行 npm install @ferrucc-io/emoji-picker,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18.0.0 || ^19.0.0)、react-dom(^18.0.0 || ^19.0.0)、tailwindcss(>=3.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ferrucc-io/emoji-picker 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ferrucc-io/emoji-picker 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@ferrucc-io/emoji-picker 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ferrucc-io/emoji-picker 可以商用吗?

@ferrucc-io/emoji-picker 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ferrucc-io/emoji-picker 的下载量有多少?

根据 npm 官方下载统计,@ferrucc-io/emoji-picker 在 2026/10/15 – 2026/11/13 这 30 天内被下载 173,269 次,日均约 5,776 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ferrucc-io/emoji-picker 还在维护吗?

最新版本 0.1.2 发布于 2026/08/18(2 个月前);至今共发布 46 个版本,其中过去 12 个月发布了 4 个;首次发布于 2025/01/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。