How to create Emoji Picker in ReactJS ?
Last Updated :
29 Jul, 2024
Emojis have become an essential part of modern communication, adding a touch of emotion and fun to our messages and applications. In this article, we will explore how to create an Emoji Picker using ReactJS, allowing users to easily select and insert emojis into their text inputs or text areas.
Prerequisites:
Approach:
To create our Spreadsheet we are going to use the emoji-picker-react package because it is powerful, lightweight, and fully customizable. After that, we will add an emoji picker on our homepage using the installed package.
Steps to Create React Application:
Step 1: Create a new ReactJs project using the below command:
npx create-react-app gfg
Step 2: Move to the project directory.
cd gfg
Step 3: Install the emoji-picker-react package using the below command:
npm i emoji-picker-react
Project Structure:

The updated dependencies in package.json file will look like.
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"emoji-picker-react": "^4.5.15",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4
}
Example: This example uses Picker component from emoji-picker-react module to implement the emojipicker and display emoji on the page.
JavaScript
// Filename - App.js
import React, { useState } from "react";
import Picker from "emoji-picker-react";
export default function Emoji() {
const [chosenEmoji, setChosenEmoji] = useState(null);
const onEmojiClick = (event, emojiObject) => {
setChosenEmoji(emojiObject);
console.log(emojiObject.target);
};
return (
<div>
<h3>GeeksforGeeks Emoji Picker</h3>
{chosenEmoji ? (
<span>
Your Emoji:
<img
style={{ width: "15px" }}
src={chosenEmoji.target.src}
/>
</span>
) : (
<span>No Emoji</span>
)}
<Picker onEmojiClick={onEmojiClick} />
</div>
);
}
Steps to run the application: Run the below command in the terminal to run the app.
npm start
Output: This output will be visible on the http://localhost:3000/ on the browser window.
Similar Reads
How to create Color Picker in ReactJS ? In this article, we are going to learn how we can create a Color Picker in ReactJs. A color picker is a graphical user interface widget, usually found within graphics software or online, used to select colors and sometimes to create color schemes.Prerequisites:NodeJS or NPMReact JSApproach:To create
2 min read
How to create Emoji Picker in NextJS ? Adding an emoji picker to your Next.js app makes it easy for users to express themselves with emojis. By integrating a simple and intuitive emoji picker, you can enhance user interactions and make your app more engaging and fun. In this article, we are going to learn how we can add Emoji Picker in N
2 min read
How to create Avatar in react-native ? In this article, we will create 3 different kinds of Avatars using the react-native-paper library. An avatar is used for representation purposes in the form of icons, images, or text. In our project, we will create all these Avatars using material design. To give you a better idea of what weâre goin
6 min read
How to create Instagram Like button in ReactJS? We can create Instagram Like Button in ReactJS using the checkbox component, FormControlLabel component, and Icon component. Material UI for React has this component available for us and it is very easy to integrate. It can be used to turn an option on or off. We can create Instagram like button in
2 min read
How to create Popup box in React JS ? Popup boxes, also known as modal or dialog boxes, are common UI elements used to display additional content or interactions on top of the main page. Creating a popup box in React can be achieved using various approaches, including libraries or custom implementations. We will use the Reactjs-popup li
2 min read