1.0.2 β€’ Published 2 years ago

react-emoji-textarea-test v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-emoji-textarea πŸ˜†πŸ’–

You can use Slack-like emoji shortcuts on textarea! πŸ¦Έβ€β™‚οΈβŒ¨οΈ

Image from Gyazo

πŸ”¨ Minimum requirements

πŸ’Ύ Installation

Install the plugin via Yarn (recommended)

yarn add @nikaera/react-emoji-textarea

or via NPM

npm i @nikaera/react-emoji-textarea

πŸƒ Getting Started

Include component

import ReactEmojiTextArea from "@nikaera/react-emoji-textarea";

Make some elegant textarea

<ReactEmojiTextArea
  style={{ fontSize: "1em" }}
  ref={textAreaEl}
  onChange={(text) => console.log(text)}
  placeholder={"Try typing emoji like a Slack shortcut! πŸ˜†πŸ’–"}
  emojiPickerProps={{
    showSkinTones: true,
  }}
/>

πŸ› οΈ Configuring the plugin

Props for ReactEmojiTextArea include the following, which you can customize as you see fit. 🀡

export interface EmojiTextAreaProps {
  ref?: React.RefObject<HTMLTextAreaElement>;
  rows?: number;
  cols?: number;
  style?: React.CSSProperties;
  placeholder?: string;
  showPicker?: boolean;
  emojiPickerProps?: PickerProps;
  onClick?: (e: React.MouseEvent<HTMLTextAreaElement>) => void;
  onSuggesting?: (val: boolean) => void;
  onChange: (val: string) => void;
}
AttributeRequiredTypeDefaultDescription
ref-React.RefObject<HTMLTextAreaElement>nullUse this when you want to refer to a textarea element.
rows-number3Specifying rows for textarea.
cols-number40Specifying cols for textarea.
style-React.CSSPropertiesnullSpecifying the style of a textarea.
placeholder-stringnullSpecifying a placeholder for a textarea.
showPicker-booleanfalseToggle the display of emoji-mart's Picker.
emojiPickerProps-PickerPropsnullSpecify the props for emoji-mart's Picker. onSelect is used in react-emoji-textarea.
onClick-functionnullFunction to determine that a textarea field has been clicked.
onSuggesting-functionnullFunction to determine while an emoji input candidate is displayed.
onChangeβœ…functionnullFunction used to get the content of the textarea.

πŸ”¨ How to develop

  1. Use create-react-app to create a typescript project for react-emoji-textarea development.
  2. Clone react-emoji-textarea with git clone git@github.com:nikaera/react-emoji-textarea.git.
  3. Go into the react-emoji-textarea folder and run yarn or npm install to install the necessary libraries.
  4. Run npm link or yarn link to link from the project you created in step 1. for development.
  5. Add "react-emoji-textarea": "link:<1.'s project path>" to dependencies in package.json of the project created in 1..
  6. Go into the react-emoji-textarea folder and run yarn build:watch or npm run build:watch to continue to be compiled for development.
  7. Run yarn start or npm start in the project folder created in 1. to develop react-emoji-textarea.

🎁 Contributing

If you have any questions, please feel free to create an Issue or PR for you! πŸ™Œ

License

MIT