π« A web component for rendering accessible emojis.
This web component takes an emoji text node and wraps it with accessible markup:
- βΏ Follows a11y best practices
- π·οΈ Handles
aria-label
withlabel
attribute - π Sets
aria-role
to image
Download the e-moji.js
file and add it to your project, then define the custom element in your JavaScript file:
import EMoji from "./path/to/e-moji.js";
customElements.define(...EMoji);
By default, the tag name is e-moji
. If you would like to use a different tag name, you can import the web-component class directly and use your own:
import { EMoji } from "./path/to/e-moji.js";
customElements.define("your-custom-tag-name", EMoji);
Wrap the web component around an emoji and optionally add a label
attribute:
<e-moji label="smiling">π</e-moji>
<br />
<e-moji>π€</e-moji>
Which will render:
<span role="img" aria-label="smiling">π</span>
<br />
<span role="img" aria-hidden="true">π€</span>
MIT