{"id":15641284,"url":"https://github.com/seanmcp/a11y-react-emoji","last_synced_at":"2025-08-19T21:31:32.393Z","repository":{"id":33979676,"uuid":"164225861","full_name":"SeanMcP/a11y-react-emoji","owner":"SeanMcP","description":"⚛️ An accessible Emoji component for React applications","archived":false,"fork":false,"pushed_at":"2023-01-07T04:29:43.000Z","size":793,"stargazers_count":72,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-09T18:11:51.268Z","etag":null,"topics":["a11y","accessible","component","emoji","emoji-component","react"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/a11y-react-emoji","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SeanMcP.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-05T15:13:56.000Z","updated_at":"2024-03-14T09:14:44.000Z","dependencies_parsed_at":"2023-01-15T03:46:30.733Z","dependency_job_id":null,"html_url":"https://github.com/SeanMcP/a11y-react-emoji","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeanMcP%2Fa11y-react-emoji","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeanMcP%2Fa11y-react-emoji/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeanMcP%2Fa11y-react-emoji/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeanMcP%2Fa11y-react-emoji/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SeanMcP","download_url":"https://codeload.github.com/SeanMcP/a11y-react-emoji/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230367928,"owners_count":18215338,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["a11y","accessible","component","emoji","emoji-component","react"],"created_at":"2024-10-03T11:42:05.404Z","updated_at":"2024-12-19T03:09:04.896Z","avatar_url":"https://github.com/SeanMcP.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# a11y-react-emoji\n\n[![npm](https://img.shields.io/npm/v/a11y-react-emoji.svg)](https://npmjs.com/package/a11y-react-emoji) [![npm bundle size (minified)](https://img.shields.io/bundlephobia/min/a11y-react-emoji.svg)](https://npmjs.com/package/a11y-react-emoji) [![npm](https://img.shields.io/npm/dt/a11y-react-emoji.svg)](https://npmjs.com/package/a11y-react-emoji)\n\n⚛️ An accessible Emoji component for React applications\n\n## Why?\nEmojis can add a light playfulness to your project but require some specific formatting in order to ensure they are accessible for all users. `a11y-react-emoji`'s reusable `Emoji` component helps you do that quickly and painlessly.\n\n## How\nThe `Emoji` component wraps the provided symbol in a `span` with a `role=\"img\"` attribute. If a label is provided, then it is passed as an `aria-label` to the span. If not, then `aria-hidden` is set to `true`.\n\n```html\n\u003cspan aria-label=\"a rocket blasting off\" role=\"img\"\u003e🚀\u003c/span\u003e\n\u003cspan aria-hidden=\"true\" role=\"img\"\u003e🤫\u003c/span\u003e\n```\n\nThis follows the pattern recommended by [Léonie Watson](http://tink.uk/accessible-emoji/) and used by [eslint-plugin-jsx-a11y](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/accessible-emoji.md).\n\n## Installation\nAdd `a11y-react-emoji` to your project:\n\n```sh\nnpm install --save a11y-react-emoji\n# or\nyarn add a11y-react-emoji\n```\n\n## Use\nImport `Emoji`, a default export, from `a11y-react-emoji` and add it to your code:\n\n```jsx\n...\nimport Emoji from 'a11y-react-emoji'\n\nfunction HeartFooter() {\n    return (\n        \u003cfooter\u003e\n            Made with\n            {' '}\n            \u003cEmoji symbol=\"💕\" label=\"love\" /\u003e\n            {' '}\n            by Sean McPherson\n        \u003c/footer\u003e\n    )\n}\n```\n\nThe named `EmojiProps` type interface is also available for import if needed:\n\n```ts\nimport Emoji, { EmojiProps } from 'a11y-react-emoji'\n```\n\n## Emoji component\nThe `Emoji` component consumes two props: `symbol` and `label`. Every other prop is spread to the top-level JSX element, in this case a `\u003cspan\u003e`.\n\n```ts\ninterface Props extends React.HTMLAttributes\u003cHTMLSpanElement\u003e {\n    label?: string; // optional\n    symbol: string; // required\n}\n```\n\n## Considerations\nIf you are using `a11y-react-emoji` with a CSS-in-JS library like `styled-components` or `emotion`, keep in mind that **all additional props** are passed to the JSX element.\n\n### Styling an Emoji with `styled-components`\n\n```jsx\nimport styled, { css } from 'styled-components'\nimport Emoji from 'a11y-react-emoji'\n\nconst StyledEmoji = styled(({ isSpinning, ...props }) =\u003e \u003cEmoji {...props} /\u003e)`\n    font-size: 32px;\n\n    ${props =\u003e props.isSpinning \u0026\u0026 css`\n        animation: spinning 1s linear infinite;\n    `}\n`\n```\n\n## License\n\n[MIT](/LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanmcp%2Fa11y-react-emoji","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseanmcp%2Fa11y-react-emoji","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanmcp%2Fa11y-react-emoji/lists"}