@svgmoji/twemoji
v3.2.0
Published
The svgmoji sprites for the [`twemoji`](https://github.com/twitter/twemoji) library provided by Twitter.
Downloads
149,708
Readme
@svgmoji/twemoji
The svgmoji sprites for the
twemoji
library provided by Twitter.
Installation
# yarn
yarn add @svgmoji/twemoji
# pnpm
pnpm add @svgmoji/twemoji
# npm
npm install @svgmoji/twemoji
Usage
The following code creates an image with a src applied from the cdn. The first it is used it loads the sprite of all the emojis.
import { Twemoji } from '@svgmoji/twemoji';
import data from 'svgmoji/emoji.json';
const twemoji = new Twemoji({ data, type: 'all' });
const image = document.createElement('img');
image.src = twemoji.url('❤️');
document.body.append(image);
html
<!-- Individual -->
<img
width="40px"
height="40px"
src="https://cdn.jsdelivr.net/npm/@svgmoji/[email protected]/svg/1F44D.svg"
alt="thumbs up"
title="thumbs up"
/>
<!-- Subgroup Bundle 12KB -->
<img
width="40px"
height="40px"
src="https://cdn.jsdelivr.net/npm/@svgmoji/[email protected]/sprites/subgroups/face-affection.svg#1F385"
/>
<!-- Grouped Bundle 182KB -->
<img
width="40px"
height="40px"
src="https://cdn.jsdelivr.net/npm/@svgmoji/[email protected]/sprites/group/smileys-emotion.svg#1F441-FE0F-200D-1F5E8-FE0F"
/>
<!-- Full Sprite Bundle 7.3MB -->
<img
width="40px"
height="40px"
src="https://cdn.jsdelivr.net/npm/@svgmoji/[email protected]/sprites/all.svg#1F441-FE0F-200D-1F5E8-FE0F"
/>