{"id":19818845,"url":"https://github.com/ceamkrier/radix-multi-select-filter","last_synced_at":"2026-06-04T20:31:11.707Z","repository":{"id":199460483,"uuid":"702678294","full_name":"CeamKrier/radix-multi-select-filter","owner":"CeamKrier","description":"A showcase of React component built with Radix-UI for multi-selection and real-time search with Fuse.js.","archived":false,"fork":false,"pushed_at":"2023-10-10T08:45:29.000Z","size":246,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T20:02:29.128Z","etag":null,"topics":["fusejs","multiselect","radix-ui","react","react-query"],"latest_commit_sha":null,"homepage":"https://ceamkrier.github.io/radix-multi-select-filter/","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/CeamKrier.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-10-09T19:28:57.000Z","updated_at":"2024-07-30T19:43:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"7eaaaca6-98ec-4a43-a89f-5236ce52b832","html_url":"https://github.com/CeamKrier/radix-multi-select-filter","commit_stats":null,"previous_names":["ceamkrier/radix-multi-select-filter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CeamKrier/radix-multi-select-filter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CeamKrier%2Fradix-multi-select-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CeamKrier%2Fradix-multi-select-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CeamKrier%2Fradix-multi-select-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CeamKrier%2Fradix-multi-select-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CeamKrier","download_url":"https://codeload.github.com/CeamKrier/radix-multi-select-filter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CeamKrier%2Fradix-multi-select-filter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33917202,"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-06-04T02:00:06.755Z","response_time":64,"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":["fusejs","multiselect","radix-ui","react","react-query"],"created_at":"2024-11-12T10:17:04.455Z","updated_at":"2026-06-04T20:31:11.689Z","avatar_url":"https://github.com/CeamKrier.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MultiSelect Component\n\nThe MultiSelect Component is designed to provide a user-friendly interface for selecting multiple options from a list. It fetches data from a specified remote address, and allows for real-time searching and selection of options. This documentation outlines the key features of the component, the libraries and hooks used, and the rationale behind the design choices made.\n\n## Try it\n\nYou can check the working demo on here: [https://ceamkrier.github.io/radix-multi-select-filter/](https://ceamkrier.github.io/radix-multi-select-filter/)\n\n## Table of Contents\n\n1. [Key Features](#key-features)\n2. [Libraries and Hooks Used](#libraries-and-hooks-used)\n3. [Usage](#usage)\n4. [Component Structure](#component-structure)\n5. [Error Handling and Retry Mechanism](#error-handling-and-retry-mechanism)\n6. [Example Data for Testing](#example-data-for-testing)\n\n## Key Features\n\n- **Remote Data Fetching**: \n    - Fetches options from a remote server to ensure data is always up-to-date.\n- **Error Handling**:\n    - Graceful error handling with a retry mechanism for failed data fetches.\n- **Real-Time Search**:\n    - Utilizes Fuse.js for real-time search functionality, allowing users to easily filter through the available options.\n- **Refetching on Demand**:\n    - Provides a \"Retry\" button to trigger a refetch in case of an error.\n    \n## Libraries and Hooks Used\n\n- **React**:\n    - Utilizes state and effect hooks for managing component state and side effects.\n- **React Query**:\n    - Used for data fetching, caching, and state management. \n    - Handles data fetching and provides hooks for managing query state.\n    - Provides a `useQuery` hook to manage fetching, caching, and the state of the fetched data.\n- **React Router Dom**:\n    - The `useSearchParams` hook is used to manage query parameters in the URL.\n- **Radix UI**:\n    - Provides accessible UI primitives for building the user interface.\n- **Fuse.js**:\n    - Lightweight fuzzy-search library, which is utilized for real-time search functionality.\n  \n## Usage\n\n```javascript\nimport MultiSelect from './MultiSelect';\n\nfunction App() {\n    return (\n        \u003cMultiSelect optionsRemoteAddress=\"https://example.com/api/options\" /\u003e\n    );\n}\n\nexport default App;\n```\n\n## Component Structure\n\nThe MultiSelect component is structured into several sub-components and utility functions to keep the code organized and maintainable:\n\n- `MultiSelectContainer`: A container component for managing loading and error states.\n- `MultiSelectOverlay`: An overlay component displayed when an error occurs.\n- `SelectOption`: Represents an individual option in the list.\n- `fetchOptions`: A utility function for fetching options from the remote server.\n  \n## Error Handling and Retry Mechanism\n\nThe component is designed to handle network errors gracefully. If a network error occurs while fetching data, an overlay is displayed with a \"Retry\" button. Users can click the \"Retry\" button to trigger a refetch of the data.\n\nThe retry mechanism is built using the `refetch` function provided by React Query, which is triggered by clicking the \"Retry\" button. The `retry` option in the `useQuery` hook is set to 2, meaning that React Query will automatically retry the fetch two times before moving to the error state.\n\n```javascript\n// Inside MultiSelect Component\n{isError ? (\n    \u003cMultiSelectOverlay\u003e\n        \u003cdiv className='flex flex-col opacity-100 text-center text-sm'\u003e\n            Failed to load data\n            \u003cbr /\u003e\n            \u003cbr /\u003e\n            \u003cButton\n                variant='solid'\n                onClick={() =\u003e\n                    refetch({\n                        type: \"active\"\n                    })\n                }\u003e\n                Retry\n            \u003c/Button\u003e\n        \u003c/div\u003e\n    \u003c/MultiSelectOverlay\u003e\n) : null}\n```\n\n## Example Data for Testing\n\nFor testing purposes, an example dataset is provided in the public folder, named `data.json`. This file contains a list of searchable keys under the \"data\" property as shown below:\n\n```json\n{\n    \"data\": [\"searchable keys\",...]\n}\n```\n\nThis dataset is used to test the fetching, searching, and selection functionalities of the MultiSelect component in a controlled environment, ensuring that the component behaves as expected with the given data structure.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fceamkrier%2Fradix-multi-select-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fceamkrier%2Fradix-multi-select-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fceamkrier%2Fradix-multi-select-filter/lists"}