Wednesday, November 27, 2024
Google search engine
HomeLanguagesHow to create Emoji Picker in NextJS ?

How to create Emoji Picker in NextJS ?

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 - neveropen</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:

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen 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!

RELATED ARTICLES

Most Popular

Recent Comments