{"id":20185189,"url":"https://github.com/sagardwivedi/utility-components","last_synced_at":"2026-04-13T15:33:12.714Z","repository":{"id":231973526,"uuid":"783147589","full_name":"sagardwivedi/utility-components","owner":"sagardwivedi","description":"Collection of utility components","archived":false,"fork":false,"pushed_at":"2024-04-07T15:56:58.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-13T17:50:31.149Z","etag":null,"topics":["bun","nextjs","react"],"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/sagardwivedi.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-07T04:11:53.000Z","updated_at":"2024-04-07T15:09:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"c497e95e-40ee-48ca-a1d7-2e4c64e55d9f","html_url":"https://github.com/sagardwivedi/utility-components","commit_stats":null,"previous_names":["sagardwivedi/utility-components"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagardwivedi%2Futility-components","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagardwivedi%2Futility-components/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagardwivedi%2Futility-components/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagardwivedi%2Futility-components/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sagardwivedi","download_url":"https://codeload.github.com/sagardwivedi/utility-components/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241622593,"owners_count":19992501,"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":["bun","nextjs","react"],"created_at":"2024-11-14T03:11:59.245Z","updated_at":"2026-04-13T15:33:07.670Z","avatar_url":"https://github.com/sagardwivedi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  Utility Components\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cb\u003eA collection of reusable React components for common tasks\u003c/b\u003e\n\u003c/p\u003e\n\n## Installation\n\nYou can install the package via npm:\n\n```bash\nnpm install sagar-utility-components\n```\n\nOr via yarn:\n\n```bash\nyarn add sagar-utility-components\n```\n\nOr via bun:\n\n```bash\nbun add sagar-utility-components\n```\n\nAfter installation, you can import the components in your React application as follows:\n\n```jsx\nimport { Each, Show } from \"sagar-utility-components\";\n```\n\n## Components\n\n### Each\n\nThe `Each` component is used for rendering each item in an array.\n\n#### Usage\n\n```jsx\n\u003cEach of={array} render={(item, index) =\u003e \u003cItem key={index} item={item} /\u003e} /\u003e\n```\n\n#### Props\n\n- `of` (`T[]`): The array of items to render.\n- `render` (`(item: T, index: number) =\u003e React.ReactNode`): A function that takes an item from the array and returns its rendering.\n\n### Show\n\nThe `Show` component is used for conditionally rendering its children based on a condition.\n\n#### Usage\n\n```jsx\n\u003cShow\u003e\n  \u003cShowWhen isTrue={condition}\u003e\n    \u003cp\u003eThis is rendered when condition is true.\u003c/p\u003e\n  \u003c/ShowWhen\u003e\n  \u003cShowElse\u003e\n    \u003cp\u003eThis is rendered otherwise.\u003c/p\u003e\n  \u003c/ShowElse\u003e\n\u003c/Show\u003e\n```\n\n#### Props\n\n- `children` (`ReactNode`): ReactNode to be conditionally rendered.\n\n### ShowWhen\n\nThe `ShowWhen` component is used as a child of `Show` to render its children when a condition is true.\n\n#### Usage\n\n```jsx\n\u003cShow\u003e\n  \u003cShowWhen isTrue={condition}\u003e\n    \u003cp\u003eThis is rendered when condition is true.\u003c/p\u003e\n  \u003c/ShowWhen\u003e\n\u003c/Show\u003e\n```\n\n#### Props\n\n- `isTrue` (`boolean`): Condition to be evaluated.\n\n### ShowElse\n\nThe `ShowElse` component is used as a child of `Show` to render its children or a specified render prop if provided.\n\n#### Usage\n\n```jsx\n\u003cShow\u003e\n  \u003cShowWhen isTrue={condition}\u003e\n    \u003cp\u003eThis is rendered when condition is true.\u003c/p\u003e\n  \u003c/ShowWhen\u003e\n  \u003cShowElse\u003e\n    \u003cp\u003eThis is rendered otherwise.\u003c/p\u003e\n  \u003c/ShowElse\u003e\n\u003c/Show\u003e\n```\n\n#### Props\n\n- `children` (`ReactNode`): ReactNode to be rendered.\n- `render` (`ReactNode`): Alternative ReactNode to be rendered if provided.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagardwivedi%2Futility-components","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsagardwivedi%2Futility-components","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagardwivedi%2Futility-components/lists"}