5.9.0 • Published 8 days ago

react-input-emoji v5.9.0

Weekly downloads
397
License
MIT
Repository
github
Last release
8 days ago

react-input-emoji 😍 😜 😂 😛

A powerful and customizable React component that seamlessly integrates emoji picker functionality into any input element, enhancing user experience.

NPM JavaScript Style Guide

📝 About

InputEmoji provides a simple and intuitive way to add emoji picker functionality to any input element in your React application. With just a few lines of code, you can enable your users to easily select and insert emojis into their text input.

The component is highly customizable, allowing you to control the styling, positioning and behavior of the emoji picker. It also supports various useful features out of the box, such as:

  • Easy integration with any input element
  • Customizable appearance via props
  • Built-in support for cleaning input on enter
  • Callback functions for onChange, onClick and onEnter events
  • Ability to keep the picker open after selecting an emoji
  • Internationalization support for multiple languages

InputEmoji leverages the power of the emoji-mart library to provide a wide range of emojis across different categories and styles. The internationalization capabilities allow you to cater to users from diverse linguistic backgrounds, making your application more inclusive and accessible.

Whether you're building a chat app, social media platform, or any other application that could benefit from emoji input, InputEmoji has you covered. Give your users a fun and engaging way to express themselves with this powerful yet easy-to-use component!

📦 Install

npm install --save react-input-emoji

🚀 Usage

After install import the react-input-emoji component to display your input with emoji support like so:

import React, { useState } from "react";
import InputEmoji from "react-input-emoji";

export default function Example() {
  const [text, setText] = useState("");

  function handleOnEnter(text) {
    console.log("enter", text);
  }

  return (
    <InputEmoji
      value={text}
      onChange={setText}
      cleanOnEnter
      onEnter={handleOnEnter}
      placeholder="Type a message"
    />
  );
}

🧩 Props

PropTypeDefaultDescription
backgroundstring"white"Specifies the background color of the input element. Accepts any valid CSS color value.
borderColorstring"#EAEAEA"Specifies the border color of the input container. Accepts any valid CSS color value.
borderRadiusnumber21Determines the border radius of the input container in pixels. Higher values result in more rounded corners.
buttonElementHTMLElement-Allows you to provide a custom HTMLElement that, when clicked, triggers the emoji picker. If this prop is provided, the default emoji picker button is removed.
buttonRefReact.MutableRefObject-Accepts a React mutable ref object that, when referenced, triggers the emoji picker. If this prop is provided, the default emoji picker button is removed.
cleanOnEnterbooleanfalseWhen set to true, the input value will be cleared after the user presses the Enter key.
colorstring"black"Specifies the color of the input text. Accepts any valid CSS color value.
fontSizenumber15Controls the font size (in pixels) of the placeholder text and input value.
fontFamilystring"sans-serif"Specifies the font family for the placeholder text and input value. Accepts any valid CSS font-family value.
heightnumber40Sets the total height (in pixels) of the area in which the input element is rendered.
keepOpenedbooleanfalseWhen set to true, the emoji picker will remain open after the user selects an emoji. Defaults to false.
languagestring'en'Specifies the language to be used for the emoji picker. Available values: 'ar', 'be', 'cs', 'de', 'en', 'es', 'fa', 'fi', 'fr', 'hi', 'it', 'ja', 'kr', 'pl', 'pt', 'ru', 'sa', 'tr', 'uk', 'vi', 'zh'.
maxLengthnumber-Limits the maximum number of characters that can be entered in the input element.
onChangefunction-A callback function that is invoked whenever the input value changes. It receives the current value as its argument.
onClickfunction-A callback function that is invoked when the input element is clicked.
onEnterfunction-A callback function that is invoked when the Enter key is pressed. It receives the current input value as its argument.
onFocusfunction-A callback function that is invoked when the input element receives focus.
onResizefunction-A callback function that is invoked when the width or height of the input element changes. It receives the current size value as its argument.
placeholderstring"Type a message"Specifies the placeholder text to be displayed when the input is empty.
placeholderColorstring"#C4C4C4"Specifies the color of the placeholder text. Accepts any valid CSS color value.
shouldConvertEmojiToImagebooleanfalseWhen set to true, emojis in the input value will be converted to images.
shouldReturnboolean-When set to true, allows the user to create a new line using the Shift + Enter or Ctrl + Enter keyboard shortcuts.
themestring-Specifies the theme for the emoji picker popup. Available values: "light", "dark", "auto".
valuestring""The current value of the input element.

License

MIT © cesarwbr

5.9.0

8 days ago

5.8.1

11 days ago

5.8.0

1 month ago

5.7.1

1 month ago

5.7.0

1 month ago

5.6.11

1 month ago

5.6.10

1 month ago

5.6.9

1 month ago

5.6.8

1 month ago

5.6.7

1 month ago

5.6.6

3 months ago

5.5.1

8 months ago

5.6.5

7 months ago

5.6.4

8 months ago

5.6.3

8 months ago

5.6.2

8 months ago

5.6.1

8 months ago

5.3.1

9 months ago

5.1.1

11 months ago

5.1.0

11 months ago

5.4.1

8 months ago

5.2.1

9 months ago

5.0.2

1 year ago

5.0.1

1 year ago

5.0.0

1 year ago

4.3.0

2 years ago

4.2.0

2 years ago

4.1.0

2 years ago

4.0.9

3 years ago

4.0.8

3 years ago

4.0.5

3 years ago

4.0.4

3 years ago

4.0.7

3 years ago

4.0.6

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

4.0.3

3 years ago

4.0.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.1.1

3 years ago

2.1.0

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago