JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3264
  • Score
    100M100P100Q109033F
  • License MIT

An emoji mixin for React

Package Exports

  • react-emoji

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-emoji) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-emoji

Circle CI NPM

An emoji mixin for React

Features

  • Switchble emoji assets (twemoji or Emoji One)
  • Supports emoticons such as :) :(

Install

npm i react-emoji
# or
bower i react-emoji # `window.ReactEmoji` is available

Usage

let App = React.createClass({
  getDefaultProps() {
    return {
      text: "foo bar 💯 :)",
    };
  },

  mixins: [
    ReactEmoji
  ],

  render() {
    return <div>{ this.emojify(this.props.text) }</div>;
  }
});

API

emojify(text, options)

Default options

All options are optional.

Properties Description Default Type
useEmoticon Use emoticon or not true Boolean
emojiType twemoji or emojione are available twemoji String
host Custom host "" String
path Custom path "" String
ext asset ext. svg or png are available svg String
attributes Attributes such as className or onClick {width: '20px', height: '20px'} Object

Tips

In tandem with react-autolink.

Development

Dependency

$ npm i

Run

$ npm start # => http://0.0.0.0:8080

Test

$ npm test

License

MIT