{"id":22123489,"url":"https://github.com/proai/react-stacks","last_synced_at":"2025-10-12T08:30:18.617Z","repository":{"id":57144807,"uuid":"177146693","full_name":"ProAI/react-stacks","owner":"ProAI","description":":inbox_tray: React.js stack components for alerts, notifications, toasts","archived":false,"fork":false,"pushed_at":"2025-01-23T22:07:08.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-23T22:11:12.174Z","etag":null,"topics":["alerts","notifications","react","stacks","toasts"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ProAI.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}},"created_at":"2019-03-22T13:39:05.000Z","updated_at":"2025-01-23T22:06:50.000Z","dependencies_parsed_at":"2022-09-05T22:30:44.167Z","dependency_job_id":null,"html_url":"https://github.com/ProAI/react-stacks","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProAI%2Freact-stacks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProAI%2Freact-stacks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProAI%2Freact-stacks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProAI%2Freact-stacks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ProAI","download_url":"https://codeload.github.com/ProAI/react-stacks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236184419,"owners_count":19108672,"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":["alerts","notifications","react","stacks","toasts"],"created_at":"2024-12-01T15:33:52.041Z","updated_at":"2025-10-12T08:30:18.324Z","avatar_url":"https://github.com/ProAI.png","language":"JavaScript","readme":"# 📥 React Stacks\n\nComponent based stack system for positioning alerts, notifications, toasts and more.\n\n## Problem\n\nUI frameworks often offer components like alerts or toasts, but mostly these frameworks are not responsible for positioning them.\n\n## Solution\n\n`react-stacks` lets you define stacks on custom positions. Then you can use the `useStack()` hook to push a React.js component to the stack, which might be an alert or a toast. If you push multiple components these components will be stacked.\n\n## Installation\n\n```shell\nnpm install react-stacks\n# or\nyarn add react-stacks\n```\n\n## Example\n\nDefine the stacks in your main application component:\n\n```jsx\nimport React from 'react';\nimport { Provider } from 'react-stacks';\n\nconst stacks = {\n  main: ({ children }) =\u003e (\n    \u003cdiv style={{ position: 'fixed', top: 0 }}\u003e{children}\u003c/div\u003e\n  ),\n  bottom: ({ children }) =\u003e (\n    \u003cdiv style={{ position: 'fixed', bottom: 0, right: 0 }}\u003e{children.reverse()}\u003c/div\u003e\n  ),\n};\n\nfunction App() {\n  return (\n    \u003cProvider stacks={stacks} autoDismiss={5000}\u003e\n      test\n    \u003c/Provider\u003e\n  );\n}\n```\n\nUse a defined stack in a child component:\n\n```jsx\nimport React from 'react';\nimport { useStack } from 'react-stacks';\n\nfunction Child() {\n  const stack = useStack('main');\n\n  return (\n    \u003cReact.Fragment\u003e\n      \u003cbutton\n        onClick={() =\u003e {\n          stack.push(\u003cdiv\u003eError!\u003c/div\u003e);\n        }}\n      \u003e\n        Test A\n      \u003c/button\u003e\n      \u003cbutton\n        onClick={() =\u003e {\n          stack.push(\u003cdiv\u003eSuccess!\u003c/div\u003e, { autoDismiss: 3000 });\n        }}\n      \u003e\n        Test B\n      \u003c/button\u003e\n    \u003c/React.Fragment\u003e\n  );\n}\n```\n\n`autoDismiss` can be either set as a prop of `\u003cProvider /\u003e` component for all stacks or as an option of the push method for an individual item. If `autoDismiss` is set to `0`, there will be no auto dismiss.\n\n## License\n\nThis package is released under the [MIT License](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproai%2Freact-stacks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproai%2Freact-stacks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproai%2Freact-stacks/lists"}