Skip to content

Instantly share code, notes, and snippets.

@luismartinezs
Last active September 1, 2022 07:46
Show Gist options
  • Save luismartinezs/48269bd43c9fc3139c824edea314a0be to your computer and use it in GitHub Desktop.
Save luismartinezs/48269bd43c9fc3139c824edea314a0be to your computer and use it in GitHub Desktop.
React a11y emoji #react #a11y
// https://medium.com/@seanmcp/%EF%B8%8F-how-to-use-emojis-in-react-d23bbf608bf7
import React from 'react';
const Emoji = props => (
<span
className="emoji"
role="img"
aria-label={props.label ? props.label : ""}
aria-hidden={props.label ? "false" : "true"}
>
{props.symbol}
</span>
);
export default Emoji;
// Usage
<>
<Emoji symbol="🐑" label="sheep"/>
{/* or */}
<Emoji symbol="🐑"/>
</>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment