{"id":26124714,"url":"https://github.com/preachjs/toast","last_synced_at":"2026-04-20T12:04:40.978Z","repository":{"id":281607066,"uuid":"945598835","full_name":"preachjs/toast","owner":"preachjs","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-10T06:51:40.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-10T07:30:37.419Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://preachjs.github.io/toast/","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/preachjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-09T19:41:43.000Z","updated_at":"2025-03-10T06:51:44.000Z","dependencies_parsed_at":"2025-03-10T07:40:51.864Z","dependency_job_id":null,"html_url":"https://github.com/preachjs/toast","commit_stats":null,"previous_names":["preachjs/toast"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preachjs%2Ftoast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preachjs%2Ftoast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preachjs%2Ftoast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preachjs%2Ftoast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/preachjs","download_url":"https://codeload.github.com/preachjs/toast/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242889291,"owners_count":20201947,"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":[],"created_at":"2025-03-10T16:49:56.566Z","updated_at":"2026-04-20T12:04:40.970Z","avatar_url":"https://github.com/preachjs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @preachjs/toast\n\n\u003e Simple toasts for preact\n\n[![NPM](https://img.shields.io/npm/v/@preachjs/toast.svg)](https://www.npmjs.com/package/@preachjs/toast)\n\n[Demo \u0026rarr;](https://preachjs.github.io/toast/)\n\n## Highlights\n\n- 💅 CSS based\n- ⚡️ Built on @preact/signals\n- 📦 Tiny bundle size (~1KB GZipped)\n- 🤌 Simple API\n\n## Install\n\n```sh\nnpm i @preachjs/toast\n```\n\n## Usage\n\n```js\nimport { toast, Toaster } from '@preachjs/toast'\n\nconst App = () =\u003e {\n  return (\n    \u003cdiv\u003e\n      \u003cbutton onClick={() =\u003e toast('hello')}\u003etoast\u003c/button\u003e\n      \u003cToaster /\u003e\n    \u003c/div\u003e\n  )\n}\n```\n\n## API\n\n### `Toaster`\n\nComponent that acts a container for the toasts.\n\n### `toast(message: string, options?: Options)`\n\nDisplays a toast with the provided message.\n\n#### Options\n\n| Name       | Type   | Default      | Description                                                                                                                     |\n| ---------- | ------ | ------------ | ------------------------------------------------------------------------------------------------------------------------------- |\n| position   | string | 'top-center' | Position of the toast. Available options: 'top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', 'bottom-right' |\n| closeDelay | number | 3000         | Delay in milliseconds before the toast automatically closes.                                                                    |\n\n#### MessageInput\n\nCan be either a string or a JSX element:\n\n```tsx\ntype MessageInput = string | JSX.Element\n```\n\n#### Toast Variants\n\n- `toast.success(message: MessageInput, options?: Options)` - Green success\n  toast\n- `toast.error(message: MessageInput, options?: Options)` - Red error toast\n- `toast.info(message: MessageInput, options?: Options)` - Blue info toast\n- `toast.warning(message: MessageInput, options?: Options)` - Yellow warning\n  toast\n\n### `toast.promise(promise: Promise, options: PromiseOptions)`\n\nDisplays toasts for different promise states.\n\n#### PromiseOptions\n\n| Name    | Type   | Description                                      |\n| ------- | ------ | ------------------------------------------------ |\n| loading | string | Message to display while the promise is pending. |\n| success | string | Message to display if the promise resolves.      |\n| error   | string | Message to display if the promise rejects.       |\n\n### Promise Example\n\n```tsx\nconst saveData = async () =\u003e {\n  const promise = fetch('/api/data')\n\n  toast.promise(promise, {\n    loading: 'Saving...',\n    success: 'Data saved!',\n    error: 'Failed to save data',\n  })\n}\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpreachjs%2Ftoast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpreachjs%2Ftoast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpreachjs%2Ftoast/lists"}