{"id":13750482,"url":"https://github.com/bmcmahen/toasted-notes","last_synced_at":"2025-04-04T11:15:25.824Z","repository":{"id":32570724,"uuid":"137281030","full_name":"bmcmahen/toasted-notes","owner":"bmcmahen","description":"simple, flexible toast notifications for react","archived":false,"fork":false,"pushed_at":"2022-12-09T17:36:33.000Z","size":2402,"stargazers_count":256,"open_issues_count":47,"forks_count":27,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-27T04:08:26.035Z","etag":null,"topics":["notifications","react","toast","toast-message"],"latest_commit_sha":null,"homepage":"https://toasted-notes.netlify.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bmcmahen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-13T23:08:09.000Z","updated_at":"2024-12-09T11:24:00.000Z","dependencies_parsed_at":"2023-01-14T21:45:27.345Z","dependency_job_id":null,"html_url":"https://github.com/bmcmahen/toasted-notes","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmcmahen%2Ftoasted-notes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmcmahen%2Ftoasted-notes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmcmahen%2Ftoasted-notes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmcmahen%2Ftoasted-notes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bmcmahen","download_url":"https://codeload.github.com/bmcmahen/toasted-notes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166168,"owners_count":20894654,"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":["notifications","react","toast","toast-message"],"created_at":"2024-08-03T08:00:36.606Z","updated_at":"2025-04-04T11:15:25.806Z","avatar_url":"https://github.com/bmcmahen.png","language":"TypeScript","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"\u003cdiv align=\"center\"\u003e\n    \n# Toasted-notes\n  \n[![npm package](https://img.shields.io/npm/v/toasted-notes/latest.svg)](https://www.npmjs.com/package/toasted-notes)\n[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=toasted%20notes%20is%20a%20react%20library%20for%20creating%20simple%2C%20flexible%20toast%20notifications.\u0026url=https://github.com/bmcmahen/toasted-notes\u0026hashtags=react,javascript)\n[![Follow on Twitter](https://img.shields.io/twitter/follow/benmcmahen.svg?style=social\u0026logo=twitter)](\nhttps://twitter.com/intent/follow?screen_name=benmcmahen\n)\n\n\u003c/div\u003e\n\nA simple but flexible implementation of toast style notifications for React extracted from [Sancho UI](https://github.com/bmcmahen/sancho).\n\n[View the demo and documentation](https://toasted-notes.netlify.com/).\n\n## Features\n\n- **An imperative API.** This means that you don't need to set component state or render elements to trigger notifications. Instead, just call a function.\n- **Render whatever you want.** Utilize the render callback to create entirely custom notifications.\n- **Functional default styles.** Import the provided css for some nice styling defaults or write your own styles.\n\n## Install\n\nInstall `toasted-notes` and its peer dependency, `react-spring`, using yarn or npm.\n\n```\nyarn add toasted-notes react-spring\n```\n\n## Example\n\n```jsx\nimport toaster from \"toasted-notes\";\nimport \"toasted-notes/src/styles.css\"; // optional styles\n\nconst HelloWorld = () =\u003e (\n  \u003cbutton\n    onClick={() =\u003e {\n      toaster.notify(\"Hello world\", {\n        duration: 2000\n      });\n    }}\n  \u003e\n    Say hello\n  \u003c/button\u003e\n);\n```\n\n## API\n\nThe notify function accepts either a string, a react node, or a render callback.\n\n```jsx\n// using a string\ntoaster.notify(\"With a simple string\");\n\n// using jsx\ntoaster.notify(\u003cdiv\u003eHi there\u003c/div\u003e);\n\n// using a render callback\ntoaster.notify(({ onClose }) =\u003e (\n  \u003cdiv\u003e\n    \u003cspan\u003eMy custom toaster\u003c/span\u003e\n    \u003cbutton onClick={onClose}\u003eClose me please\u003c/button\u003e\n  \u003c/div\u003e\n));\n```\n\nIt also accepts options.\n\n```javascript\ntoaster.notify(\"Hello world\", {\n  position: \"bottom-left\", // top-left, top, top-right, bottom-left, bottom, bottom-right\n  duration: null // This notification will not automatically close\n});\n```\n\n## Using Context\n\nOne downside to the current API is that render callbacks and custom nodes won't get access to any application context, such as theming variables provided by styled-components. To ensure that render callbacks have access to the necessary context, you'll need to supply that context to the callback.\n\n```jsx\nconst CustomNotification = ({ title }) =\u003e {\n  const theme = useTheme();\n  return \u003cdiv style={{ color: theme.primary }}\u003e{title}\u003c/div\u003e;\n};\n\nconst CustomNotificationWithTheme = withTheme(CustomNotification);\n\ntoaster.notify(() =\u003e \u003cCustomNotificationWithTheme title=\"I am pretty\" /\u003e);\n```\n\n## Contributors\n\n- [Einar Löve](https://github.com/einarlove)\n\n## License\n\nMIT\n\n## Prior art\n\nWay back, this was originally based on the wonderful implementation of notifications in [evergreen](https://evergreen.segment.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmcmahen%2Ftoasted-notes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbmcmahen%2Ftoasted-notes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmcmahen%2Ftoasted-notes/lists"}