{"id":23058684,"url":"https://github.com/suhdev/react-multi-switch","last_synced_at":"2025-06-23T14:37:59.668Z","repository":{"id":57334902,"uuid":"61430468","full_name":"suhdev/react-multi-switch","owner":"suhdev","description":"A switch ui component for ReactJS applications written in TypeScript. ","archived":false,"fork":false,"pushed_at":"2016-06-18T16:09:57.000Z","size":132,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-10T21:50:10.646Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/suhdev.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}},"created_at":"2016-06-18T11:29:44.000Z","updated_at":"2016-06-18T15:54:42.000Z","dependencies_parsed_at":"2022-09-11T08:20:35.363Z","dependency_job_id":null,"html_url":"https://github.com/suhdev/react-multi-switch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/suhdev/react-multi-switch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Freact-multi-switch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Freact-multi-switch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Freact-multi-switch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Freact-multi-switch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suhdev","download_url":"https://codeload.github.com/suhdev/react-multi-switch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Freact-multi-switch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261495848,"owners_count":23167384,"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":"2024-12-16T02:17:06.919Z","updated_at":"2025-06-23T14:37:59.636Z","avatar_url":"https://github.com/suhdev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#react-multi-switch\n\nA configurable multi-switch UI component for ReactJS application written in TypeScript.\n\n## Installation \n\n### with JSPM \n\n```bash\nmydir$ jspm install npm:react-multi-switch --save \n\n```\n\n### with NPM\n\n```bash\nmydir$ npm install react-multi-switch --save-\n```\n\n##Properties \n1. `itemWidth` a number representing the individual state width.\n2. `states` an array of states each state is an object literal containing `label` and `key` \n3. `onChange` a function to be called when the state changes, it is passed the index of the state that has been clicked, and the state's key. \n4. `selIndex` the currently selected index, the application should change this [from the onChange function] to reflect the index of the selected state. \n5. `className` an optional parameter to set another class on the MultiSwitch root element.  \n\n## Usage [ES6 and JSPM] \n1. Include the stylesheet either `react-multi-switch.min.css` [minified] or `react-multi-switch.css` [unminified].\n\n   ```html\n   \u003clink rel=\"stylesheet\" href=\"/path-to-css/react-multi-switch.min.css\" /\u003e\n   ```\n\n2. Using JSPM \n\n    ```javascript \n    import {MultiSwitch} from 'react-multi-switch'; \n    const states = [{\n        label:'Item 1',\n        key:'item1'\n    },{\n        label:'Item 2',\n        key:'item2'\n    }];\n\n    \u003cMultiSwitch itemWidth={100} onChange={(idx,key)=\u003e{}} selIndex={0} states={states} /\u003e \n\n    ```\n\n##Usage with [CommonJS modules] \n\n```javascript \nvar MultiSwitch = require('react-multi-switch').MultiSwitch; \n\nconst states = [{\n        label:'Item 1',\n        key:'item1'\n    },{\n        label:'Item 2',\n        key:'item2'\n    }];\n\n\u003cMultiSwitch itemWidth={100} onChange={(idx,key)=\u003e{}} selIndex={0} states={states} /\u003e\n\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuhdev%2Freact-multi-switch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuhdev%2Freact-multi-switch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuhdev%2Freact-multi-switch/lists"}