fluentui-emoji-js

A JavaScript wrapper for Microsoft's Fluent Emojis.

NPM Github Live Demo

Install

npm install fluentui-emoji-js

Usage

Common JS

const emoji = require('fluentui-emoji-js')

emoji.fromGlyph('👋','3D').then((emojiImg) => {
  console.log(emojiImg)
})

ES Module

import * as emoji from 'fluentui-emoji-js'

const emojiImg = await emoji.fromGlyph('👋','3D')
console.log(emojiImg)

Displaying the emoji

Both fromGlyph(glyph, style) and fromCode(code, style) return the location of the emoji image relative to the base emoji folder. You can download the assets folder from the fluentui-emoji repo or use a service like jsdelivr to get the emoji image.

Getting emoji image via jsdelivr
const emojiImage = document.querySelector('#emojiImage');
const emoji = '🍕';

emoji.fromGlyph(emoji,'3D').then((emojiImg) => {
  emojiImage.src = `https://cdn.jsdelivr.net/gh/microsoft/fluentui-emoji@latest/assets${emojiImg}`
})

More Info

fluentui-emoji-js has 2 main functions fromGlyph(glyph, style) and fromCode(code, style). Both return the location of the emoji image relative to the base emoji folder.

fromGlyph(glyph, style)

fromCode(code, style)