Easy-use emoji component for React 📦
Easy-use emoji component for React
npm install --save react-emoj
react-emoj
serves a minimal and convenient API for use.
ReactEmoji
as React Component (default export)Emoji
as an emoji utility that serves internally as a helper to ReactEmoji
(exports.Emoji)You can import them as:
import ReactEmoji, { Emoji } from 'react-emoj'
ReactEmoji
ReactEmoji shall be rendered with props
:
Type: Array(string)
Example:
<ReactEmoji emoji={['coffee', 'sunglasses']} ></ReactEmoji>
Useful when all you need to render is a list of emoticons.
Type: Object
Example:
<ReactEmoji
emoji={['coffee', 'sunglasses']}
style={{fontSize: '30px'}}
></ReactEmoji>
Useful when you need to set color/font size of text or emoticons.
ReactEmoji can be used for displaying text that includes emoji by passing the text as child to the component. The text must always be of type string
. The emoticons to be displayed shall be wrapped in colons in format
.
Example:
<ReactEmoji style={{fontSize: '30px'}}>
I :hearts: coffee
</ReactEmoji>
Emoji
Serves you a JSON
object of emoji.
Type: text: string
Emoji Format:
Example:
Emoji.emojify('I love :coffee:') // I love ☕️
Useful when all you need is an emojified
text, not a rendered component.
Type: emojiList: [string] i.e an Array of string
Emoji Format: emoji_code
Example:
Emoji.fromArray(['coffee', 'sunglasses']) // ☕️😎
Useful when all you need is an emoji list, not a rendered component.
MIT © Yatharth Khatri