Giter VIP home page Giter VIP logo

emoji.js's Introduction

emoji.js

Unicode Emoji Wrapper with JavaScript

Use as an HTML Element

There are two attributes to create emoji. The first attribute is related to emoji name. This attribute must be filled.

Second attribute is optional. An emoji size default by 15 px. You don't have to init this attribute.

<i data-emoji="grinning" data-emoji-size="48"></i>

Use as an Shortcode

For example, you have a rich text editor. You can use all emojis with their shortcode. This required an event like click.

<span>This is an example. :grin:</span>

JavaScript API

There are two example to understand emoji.js

Default Initialize emoji.js

The default usage like below.

import Emoji from "./emoji"

const emoji = new Emoji()

emoji.init()

Shortcode Example

If you want to use with shortcodes you need to use like below. There are two optional arguments.

shortcode argument by default true and shortcodeSize argument by default 16px

import Emoji from "./emoji"

const emoji = new Emoji({
    shortcode: true,
    shortcodeSize: 16
})


const btn = document.querySelector("#myEmoji")

btn.addEventListener("click", () => {
    // let's assume you clicked to `:grin:` to add your favorite editor.
    emoji.useShortCode()
})

Resource

All emojis coming from emojipedia.

Contribute

Please contribute to diversity.

Help Categories

Currently, I need to complete :

In order to help to this repository, you need to check the files under the /src/types folder. Please, respect the format.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.