Home

Awesome

Emoji Picker

:heart_eyes: :stuck_out_tongue_winking_eye: :joy: :stuck_out_tongue: Instantly add Emoji support to input fields on your website! :boom: :sparkles: :thumbsup: :metal:

<!-- use js-emoji-picker for npm -->

Example Screenshot

Installation & Usage:

  1. In your <head> section, add the following stylesheet links. Adjust the lib/css path to match yours.
  <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet">
  <link href="lib/css/emoji.css" rel="stylesheet">
  1. Before the end of your <body> section, add the following JavaScript links. This library depends on jQuery, so jQuery must also be included, before these scripts are run. Once again, adjust the lib/js path to match yours.
  <!-- ** Don't forget to Add jQuery here ** -->
  <script src="lib/js/config.min.js"></script>
  <script src="lib/js/util.min.js"></script>
  <script src="lib/js/jquery.emojiarea.min.js"></script>
  <script src="lib/js/emoji-picker.min.js"></script>
  1. On any input field, add the data attribute data-emojiable="true".

  2. Put your input field in a container with class="emoji-picker-container" to make sure picker would be displayed upper right corner of the input field.

  3. Create a new EmojiPicker instance and bind it to your input field.

    <script>
      $(function() {
        // Initializes and creates emoji set from sprite sheet
        window.emojiPicker = new EmojiPicker({
          emojiable_selector: '[data-emojiable=true]',
          assetsPath: '/lib/img/',
          popupButtonClasses: 'fa fa-smile-o' // far fa-smile if you're using FontAwesome 5
        });
        // Finds all elements with `emojiable_selector` and converts them to rich emoji input fields
        // You may want to delay this step if you have dynamically created input fields that appear later in the loading process
        // It can be called as many times as necessary; previously converted input fields will not be converted again
        window.emojiPicker.discover();
      });
    </script>
  1. That's all you need for the default options. Play around with the demo to see what the default options give you.

Configuring Options

I want the Emoji selector to input Unicode characters instead of images

Add data-emoji-input="unicode" to your input field. Only the unicode value is checked for; entering anything else has no effect.

I want to limit my input field to a certain number of characters (maxlength)

The maxlength property is supported. Character input and emoji input each count as one character, so it'll stop you from entering more than the max length.

I want classes from my original input field to be copied over to the rich emoji input area

They are!

Trivia

You get:

What happens under the hood:

Credits:

This was originally built to power emoji selection for OneSignal, an omni-channel customer engagement platform.

This is a slightly modified version of angular-emoji-popup, which was written based on jquery-emojiarea (converts input fields to rich emoji input areas) and uses nanoScrollerJs (for the popup's custom-skinned scrollbar). This version removes AngularJS as a dependency.

Improvements from the original forks: