# Getting started
Package: @mantine/emoji
Description: Get started with @mantine/emoji package

## Installation

```bash
yarn add @mantine/emoji
```

```bash
npm install @mantine/emoji
```

After installation import package styles at the root of your application:

```tsx
import '@mantine/core/styles.css';
// ‼️ import emoji styles after core package styles
import '@mantine/emoji/styles.css';
```

## Emoji data

`@mantine/emoji` does not include emoji data, pass it with the `data` prop.
The package exports adapters for two popular emoji data sources:

### Using @emoji-mart/data

Install the data package:

```bash
yarn add @emoji-mart/data
```

```bash
npm install @emoji-mart/data
```

Then use the adapter to convert the data:

```tsx
import data from '@emoji-mart/data';
import { emojiMartAdapter, EmojiPicker } from '@mantine/emoji';

const emojiData = emojiMartAdapter(data);

function Demo() {
  return <EmojiPicker data={emojiData} />;
}
```

### Using emojibase-data

Install the data package:

```bash
yarn add emojibase-data
```

```bash
npm install emojibase-data
```

Then use the adapter to convert the data:

```tsx
import data from 'emojibase-data/en/data.json';
import messages from 'emojibase-data/en/messages.json';
import { emojibaseAdapter, EmojiPicker } from '@mantine/emoji';

const emojiData = emojibaseAdapter(data, messages);

function Demo() {
  return <EmojiPicker data={emojiData} />;
}
```

### Custom data

You can also build the data yourself with the `EmojiPickerData` interface:

```tsx
import { EmojiPicker, EmojiPickerData } from '@mantine/emoji';

const data: EmojiPickerData = {
  categories: [
    { id: 'people', label: 'Smileys & People', emojis: ['grinning', 'wave'] },
  ],
  emojis: {
    grinning: {
      id: 'grinning',
      name: 'Grinning Face',
      keywords: ['happy', 'smile'],
      emoji: '😀',
    },
    wave: {
      id: 'wave',
      name: 'Waving Hand',
      keywords: ['hello', 'hi'],
      emoji: '👋',
      skins: ['👋🏻', '👋🏼', '👋🏽', '👋🏾', '👋🏿'],
    },
  },
};

function Demo() {
  return <EmojiPicker data={data} />;
}
```

## Canonical category IDs

Both adapters return the same category IDs in this order, use them as keys of the `categoryLabels` prop:

* `people` – Smileys & People
* `nature` – Animals & Nature
* `foods` – Food & Drink
* `activity` – Activity
* `places` – Travel & Places
* `objects` – Objects
* `symbols` – Symbols
* `flags` – Flags

To display recently used emojis, add a category with `id: 'frequent'` to your data.
It is displayed with a clock icon in the category navigation.
