0.0.1 • Published 1 year ago

react-input-emoji-patch v0.0.1

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

react-input-emoji

A React input with an option to pick emojis

NPM JavaScript Style Guide

About

InputEmoji provides a simple way to have an input element with emoji picker support. Click the picker button next to the input field and select an emoji from the popup window. Done!

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
valuestring""The input value.
onChangefunction-This function is called when the value of the input changes. The first argument is the current value.
onResizefunction-This function is called when the width or the height of the input changes. The first argument is the current size value.
onClickfunction-This function is called when the input is clicked.
onFocusfunction-This function is called when the input has received focus.
cleanOnEnterbooleanfalseClean the input value after the keydown event.
onEnterfunction-This function is called after the keydown event is fired with the keyCode === 13 returning the last value.
placeholderstring"Type a message"Set the placeholder of the input.
heightnumber40The total height of the area in which the element is rendered.
maxLengthnumber-The maximum number of characters allowed in the element.
themestring-Set theme for emoji popup. Available values "light", "dark", "auto"
borderRadiusnumber21The border radius of the input container.
borderColorstring"#EAEAEA"The border color of the input container.
fontSizenumber15The font size of the placeholder and input container.
fontFamilystring"sans-serif"The font family of the placeholder and input container.

License

MIT © cesarwbr