{"id":15043030,"url":"https://github.com/blvdmitry/react-awesome-toasts","last_synced_at":"2025-12-03T17:01:07.991Z","repository":{"id":41798230,"uuid":"155979625","full_name":"blvdmitry/react-awesome-toasts","owner":"blvdmitry","description":"Toast notifications for react. ","archived":false,"fork":false,"pushed_at":"2022-12-09T14:05:31.000Z","size":1537,"stargazers_count":61,"open_issues_count":18,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-18T06:23:11.793Z","etag":null,"topics":["a11y","accessibility","component","notifications","react","reactjs","toast","typescript"],"latest_commit_sha":null,"homepage":"https://bananabobby.github.io/react-awesome-toasts/","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/blvdmitry.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":"2018-11-03T12:10:20.000Z","updated_at":"2024-03-14T18:53:55.000Z","dependencies_parsed_at":"2023-01-25T18:00:16.220Z","dependency_job_id":null,"html_url":"https://github.com/blvdmitry/react-awesome-toasts","commit_stats":null,"previous_names":["bananabobby/react-awesome-toasts"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blvdmitry%2Freact-awesome-toasts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blvdmitry%2Freact-awesome-toasts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blvdmitry%2Freact-awesome-toasts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blvdmitry%2Freact-awesome-toasts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blvdmitry","download_url":"https://codeload.github.com/blvdmitry/react-awesome-toasts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248955548,"owners_count":21189158,"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","accessibility","component","notifications","react","reactjs","toast","typescript"],"created_at":"2024-09-24T20:48:28.792Z","updated_at":"2025-12-03T17:01:07.876Z","avatar_url":"https://github.com/blvdmitry.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Awesome Toasts\n\nEasily customizable React notification system that manages its queue for you. \n\nhttps://bananabobby.github.io/react-awesome-toasts/\n\n- 🎙 Screen reader accessibility\n- 🔧 Server side rendering support\n- 📱 Responsive\n- 📘 Typescript support \n- 📦 React is the only dependency\n- 🎉 5kb gzipped \n\n### Get started\n\nInstall the package:\n\n```\nyarn add react-awesome-toasts\n// or\nnpm install react-awesome-toasts \n```\n\nWrap your app with `ToastProvider`:\n\n```\nimport { ToastProvider } from 'react-awesome-toasts';\n\nconst App = () =\u003e {\n    return (\n        \u003cToastProvider\u003e\n            App content\n        \u003c/ToastProvider\u003e\n    )\n} \n```\n\nAdd toast methods to your component with one of the following methods:\n\n*With High Order Component:*\n \n```\nimport { withToast } from 'react-awesome-toasts';\n\nconst ToastButton = ({ toast }) =\u003e {\n    const toastProps = {\n        text: 'Message sent',\n        actionText: 'Undo',\n        ariaLabel: 'Message sent, click to undo',\n        onActionClick: toast.hide,\n    };\n    \n    return \u003cButton onClick={() =\u003e toast.show(toastProps)}\u003eShow toast\u003c/Button\u003e;\n}\n\nexport default withToast(ToastButton);\n```\n\n*With ToastConsumer:*\n\n\n```\nimport { ToastConsumer } from 'react-awesome-toasts';\n\nconst toastProps = {\n    text: 'Message sent',\n    actionText: 'Undo',\n    ariaLabel: 'Message sent, click to undo',\n};\n\n\u003cToastConsumer\u003e\n    {\n        ({ show, hide }) =\u003e (\n            \u003cButton onClick={() =\u003e show({ ...toastProps, onActionClick: hide )}\u003e\n                Show toast\n            \u003c/Button\u003e    \n        )\n    }\n\u003c/ToastConsumer\u003e    \n```\n\n### Provided methods\n\n`hide()` - hides currently active toast.\n\n`show(props)` - shows a toast and passes all props to the presentational component \n\n### Presentational Toast component\n\nBy default `ToastProvider` uses `Toast` component provided by the library.\n`Toast` component is responsible for the accessibility and responsiveness of notifications.\nKeep in mind, that if your replace it with your custom component - you will have to handle both of these features in your component if you need them in your app.\n\nDefault `Toast` component has follow properties:\n\n| Property        | Description                      |\n| --------------- | -------------------------------- |\n| text `string`, required | Message to display in notification |\n| actionText `string` | Text of the action button |\n| onActionClick `func` | Action button click handler |\n| ariaLabel `string` | Default: `text` property value. Should be used for better accessibility. |\n| variant `\"error\"` | Variant of message |\n\n### Accessibility\n\nDefault presentational `Toast` component provides accessibility features:\n\n- When toast is opened, action button gets focused if its present\n- When toast is hidden, previous focus is restored\n- When toast is shown, screen reader reads its message or `ariaLabel` value. Since action button gets focused automatically - it's nice to have an aria-label that mentions it, e.g. `Item deleted, click to undo.  \n\n### Customization\n\n`ToastProvider` accepts properties for customizing the behaviour of the notifications.\n\n| Property        | Description                      |\n| --------------- | -------------------------------- |\n| timeout `number` | Default: `4500`. The time until a toast is dismissed, in milliseconds. |\n| component | Presentational component for displaying notifications. |\n| position `top-right, bottom-right, top-left, bottom-left, top-center, bottom-center` | Default: `bottom-left`. Position of the toasts on the screen. |\n\n### Roadmap\n\n- Improve accessibility for focused toast actions\n- Check colors AA accessibility level\n- Let toasts hide without animation\n- Custom container classnames\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblvdmitry%2Freact-awesome-toasts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblvdmitry%2Freact-awesome-toasts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblvdmitry%2Freact-awesome-toasts/lists"}