In this article, we are going to learn how we can add Emoji Picker in NextJS. NextJS is a React-based framework. It has the power to Develop beautiful Web applications for different platforms like Windows, Linux, and mac.
Approach: To add our Emoji Picker, we are going to use the react-input-emoji package. The react-input-emoji package helps us to add emoji pickers anywhere in our app. So first, we will install the react-input-emoji package and then we will add the Emoji Picker on our homepage.
Create NextJS Application: You can create a new NextJs project using the below command:
npx create-next-app gfg
Install the required package: Now we will install the react-input-emoji package using the below command:
npm i react-input-emoji
Project Structure: It will look like this.

Adding the Emoji Picker: We can easily add the emoji picker in our app after installing the react-input-emoji package. For this example, we are going to add the emoji picker to our homepage.
index.js
import React, { useState } from "react";
import InputEmoji from "react-input-emoji";
export default function EmojiInput() {
const [text, setText] = useState("");
return (
<div>
<h4>NextJs EmojiPicker - GeeksforGeeks</h4>
<br/>
<br/>
<br/>
<br/>
<InputEmoji
value={text}
onChange={setText}
cleanOnEnter
placeholder="Type a message"
/>
</div>
);
}
|
Explanation: In the above example first, we are importing the InputEmoji component from the installed package. After that, we are adding our Emoji Picker using the installed package.
Steps to run the application: Run the below command in the terminal to run the app
npm run dev
Output:
Learn to code easily with our course
Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated :
02 Feb, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...