npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kickscondor/emoji-button

v2.1.4

Published

Vanilla JavaScript emoji picker

Downloads

6

Readme

Emoji Button

Vanilla JavaScript emoji picker 😎

npm package

Screenshot

Demo

https://joeattardi.github.io/emoji-button

Features

  • 💻 Vanilla JS, use with any framework
  • 🔎 Emoji search
  • 👍🏼 Skin tone variations
  • ⏱ Recently used emojis

Installation

npm install --save emoji-button

Basic usage

  import EmojiButton from 'emoji-button';

  const button = document.querySelector('#emoji-button');
  const picker = new EmojiButton();

  picker.on('emoji', emoji => {
    document.querySelector('input').value += emoji;
  });

  button.addEventListener('click', () => {
    picker.pickerVisible ? picker.hidePicker() : picker.showPicker(button);
  });

API

new EmojiButton(options)

Creates an Emoji Button emoji picker.

Options

  • position: The position to display the picker relative to the reference element. Valid values are:

    • auto
    • auto-start
    • auto-end
    • top
    • top-start
    • top-end
    • right
    • right-start
    • right-end
    • bottom
    • bottom-start
    • bottom-end
    • left
    • left-start
    • left-end
  • rootElement: The root DOM node to attach the picker to. Defaults to the body if not passed in.

  • autoHide: (boolean, default: true) Whether or not the picker should automatically be hidden when an emoji is clicked.

  • i18n: An object containing localized messages to display in the UI. The values and their defaults are as follows:

{
  search: 'Search',
  categories: {
    recents: 'Recently Used',
    smileys: 'Smileys & People',
    animals: 'Animals & Nature',
    food: 'Food & Drink',
    activities: 'Activities',
    travel: 'Travel & Places',
    objects: 'Objects',
    symbols: 'Symbols',
    flags: 'Flags'
  },
  notFound: 'No emojis found'
}

showPicker(referenceElement)

Shows the picker, positioning it relative to the given reference element. The reference element is usually the button or other element that was clicked to open the picker.

hidePicker()

Hides the picker.

pickerVisible (property)

Will be true if the picker is currently visible, and false if not.

on(event, callback)

Adds an event listener. Currently there is only one event:

  • emoji: Fired when an emoji is picked. The callback is called with a single argument, the emoji character that was picked.

Development

The easiest way to hack on Emoji Button is to use the examples page.

Clone the repository

git clone https://github.com/joeattardi/emoji-button.git

From the repository root

Install dependencies

npm install

Set up the link

npm link

Start the build/watch loop

npm run build:watch

From the examples subdirectory

Install dependencies

npm install

Link the library

npm link emoji-button

Start the dev server

npm start

Open the page

http://localhost:5000