{"id":16513779,"url":"https://github.com/wintercounter/buttered-toast","last_synced_at":"2026-07-12T23:31:36.269Z","repository":{"id":187631678,"uuid":"677383450","full_name":"wintercounter/buttered-toast","owner":"wintercounter","description":"An incredibly simple toast notification system for React.","archived":false,"fork":false,"pushed_at":"2023-08-11T14:14:51.000Z","size":5,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T08:41:33.071Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/wintercounter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-11T12:41:54.000Z","updated_at":"2024-04-13T10:13:47.000Z","dependencies_parsed_at":"2023-08-11T14:41:12.845Z","dependency_job_id":null,"html_url":"https://github.com/wintercounter/buttered-toast","commit_stats":null,"previous_names":["wintercounter/buttered-toast"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wintercounter/buttered-toast","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wintercounter%2Fbuttered-toast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wintercounter%2Fbuttered-toast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wintercounter%2Fbuttered-toast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wintercounter%2Fbuttered-toast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wintercounter","download_url":"https://codeload.github.com/wintercounter/buttered-toast/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wintercounter%2Fbuttered-toast/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35405750,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-12T02:00:06.386Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-11T16:10:16.651Z","updated_at":"2026-07-12T23:31:36.249Z","avatar_url":"https://github.com/wintercounter.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# buttered-toast\n\nAn incredibly simple toast notification system for React.\n\n-   Only 894 byte (gzipped)\n-   No dependencies\n-   No styling, only logic\n-   No configuration\n-   No nonsense\n-   Render components\n-   No JSX during usage\n\nThis is a solution I'm using in several projects, so I decided to extract this into its own package. The existing\nlibraries out there require you to add JSX elements to your React tree and render them based on conditions (controlled\nway). I never liked such solutions, I prefer a simple function call to show my toast.\n\n## Installation\n\n```bash\nnpm install buttered-toast\n```\n\n## Usage\n\n### Add context provider\n\n```javascript\nimport { ToastContextProvider } from 'buttered-toast'\n\nconst App = ({ children }) =\u003e \u003cToastContextProvider\u003e{children}\u003c/ToastContextProvider\u003e\n```\n\n### `useToast` hook\n\n```javascript\nimport { useToast } from 'buttered-toast'\n\nconst Component = () =\u003e {\n    const { show } = useToast()\n    return \u003cbutton onClick={() =\u003e show('Button clicked!')}\u003eClick me!\u003c/button\u003e\n}\n```\n\n## API and Customization\n\n### Exports\n\n-   `ToastContextProvider`\n-   `useToast`\n-   `defaultOptions`\n-   `ToastContext`\n\n### `ToastContextProvider`\n\nThis is a React context provider that provides the state for `useToast` hooks. You must have this at least once in your\nReact tree.\n\n#### Props\n\n-   `options` - An object of options to override the default options. See `defaultOptions` for more information.\n\n### `useToast`\n\nThis is a React hook that provides the `show` function to show a toast.\n\n```js\nconst { show } = useToast()\n```\n\n#### `show`\n\nThis function takes a two arguments argument. The content to show in the toast and an optional `options` object to\noverride the options for this specific toast.\n\n-   `content` - The content to show in the toast. This can be anything that React can render as `children`.\n-   `options` _(optional)_ - An object of options to override the default options. See `defaultOptions` for more\n    information.\n\n```js\nshow(\u003c\u003eButton clicked!\u003c/\u003e)\nshow(\u003cMyToastStyle\u003eButton clicked!\u003c/MyToastStyle\u003e)\n```\n\n### `defaultOptions`\n\nAn object of default options. These options can be overridden by passing an `options` object to the\n`ToastContextProvider`.\n\n-   `duration` - The duration in milliseconds to show the toast. Defaults to `3000`.\n-   `ref` - A ref to the toast element. Defaults to `null`. In case a `ref` is provided, React's `createPortal` will be\n    used to render the toast. If no `ref` is provided, the toast will be rendered in the `ToastContextProvider`.\n-   `Wrapper `- A wrapper component to wrap the toast in. Defaults to and \"empty component\":\n    `({ children }) =\u003e children`.\n-   `wrapperProps` - Props to pass to the wrapper component. Defaults to `{}`.\n\n### `ToastContext`\n\nThis is the React context that is provided by the `ToastContextProvider`. You can use this context to create your own.\n\n## Styling\n\nThis library does not provide any styling. You can style your toast by creating your own Toast component, and/or by\nstyling your Wrapper element.\n\n## Advanced example\n\n```javascript\nimport { ToastContextProvider, defaultOptions } from 'buttered-toast'\n\nconst App = ({ children }) =\u003e (\n    \u003cToastContextProvider\n        options={{\n            ...defaultOptions,\n            duration: 5000,\n            Wrapper: ({ children, title }) =\u003e (\n                \u003cdiv className=\"my-wrapper\"\u003e\n                    \u003cdiv className=\"my-title\"\u003e{title}\u003c/div\u003e\n                    {children}\n                \u003c/div\u003e\n            ),\n            wrapperProps: { title: 'System notification' }\n        }}\n    \u003e\n        {children}\n    \u003c/ToastContextProvider\u003e\n)\n```\n\n```javascript\nimport { useToast } from 'buttered-toast'\n\nconst Component = () =\u003e {\n    const { show } = useToast()\n    return (\n        \u003cbutton\n            onClick={() =\u003e\n                show(\u003cToastStyle\u003eButton clicked!\u003c/ToastStyle\u003e, {\n                    duration: 10000,\n                    wrapperProps: { title: 'What just happened?' }\n                })\n            }\n        \u003e\n            Click me!\n        \u003c/button\u003e\n    )\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwintercounter%2Fbuttered-toast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwintercounter%2Fbuttered-toast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwintercounter%2Fbuttered-toast/lists"}