{"_id":"@rc-component/switch","_rev":"4537703","name":"@rc-component/switch","description":"switch ui component for react","dist-tags":{"latest":"1.0.3"},"maintainers":[{"name":"afc163","email":""},{"name":"chenshuai2144","email":""},{"name":"madccc","email":""},{"name":"peachscript","email":""},{"name":"zombiej","email":""}],"time":{"modified":"2026-04-09T15:02:11.000Z","created":"2025-02-17T07:19:32.311Z","1.0.3":"2025-11-28T02:58:01.580Z","1.0.2":"2025-09-19T06:31:14.559Z","1.0.1":"2025-09-16T07:14:31.247Z","1.0.0":"2025-02-17T07:19:32.311Z"},"users":{},"repository":{"type":"git","url":"git+ssh://git@github.com/react-component/switch.git"},"versions":{"1.0.3":{"name":"@rc-component/switch","version":"1.0.3","description":"switch ui component for react","keywords":["react","react-component","react-switch","switch"],"homepage":"http://github.com/react-component/switch","bugs":{"url":"http://github.com/react-component/switch/issues"},"repository":{"type":"git","url":"git+ssh://git@github.com/react-component/switch.git"},"license":"MIT","main":"lib/index","module":"./es/index","scripts":{"compile":"father build && lessc assets/index.less assets/index.css","docs:build":"dumi build","docs:deploy":"gh-pages -d .doc","gh-pages":"npm run docs:build && npm run docs:deploy","lint":"eslint .","lint-staged":"lint-staged","prepare":"husky install && dumi setup","prepublishOnly":"npm run compile && rc-np","postpublish":"npm run gh-pages","start":"dumi dev","test":"umi-test"},"lint-staged":{"**/*.{js,jsx,tsx,ts,md,json}":["prettier --write"]},"dependencies":{"@rc-component/util":"^1.3.0","clsx":"^2.1.1"},"devDependencies":{"@rc-component/father-plugin":"^2.0.0","@rc-component/np":"^1.0.3","@types/jest":"^29.4.0","@types/node":"^24.5.2","@types/react":"^19.1.14","@types/react-dom":"^19.1.9","@umijs/fabric":"^3.0.0","cheerio":"1.0.0-rc.12","dumi":"^2.0.0","enzyme":"^3.0.0","enzyme-adapter-react-16":"^1.0.1","enzyme-to-json":"^3.0.0","eslint":"^8.55.0","eslint-plugin-jest":"^27.6.0","eslint-plugin-unicorn":"^49.0.0","father":"^4.0.0","gh-pages":"^6.1.0","husky":"^8.0.1","less":"^4.1.3","lint-staged":"^15.1.0","prettier":"^3.1.0","react":"^16.0.0","react-dom":"^16.0.0","react-test-renderer":"^16.0.0","umi-test":"^1.9.7"},"peerDependencies":{"react":">=16.9.0","react-dom":">=16.9.0"},"_id":"@rc-component/switch@1.0.3","gitHead":"552d3205dea2f788d4de01bb2435275afd0d4b16","types":"./lib/index.d.ts","_nodeVersion":"22.8.0","_npmVersion":"11.6.0","dist":{"shasum":"d6efa8a17ca9c35f0838321c1cfe0b9adb954523","size":5130,"noattachment":false,"key":"/@rc-component/switch/-/@rc-component/switch-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/@rc-component/switch/download/@rc-component/switch-1.0.3.tgz"},"_npmUser":{"name":"afc163","email":"afc163@gmail.com"},"directories":{},"maintainers":[{"name":"afc163","email":""},{"name":"chenshuai2144","email":""},{"name":"madccc","email":""},{"name":"peachscript","email":""},{"name":"zombiej","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/switch_1.0.3_1764298681409_0.6972996817013153"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-11-28T02:58:01.580Z","publish_time":1764298681580,"_source_registry_name":"default","_cnpm_publish_time":1764298681580},"1.0.2":{"name":"@rc-component/switch","version":"1.0.2","description":"switch ui component for react","keywords":["react","react-component","react-switch","switch"],"homepage":"http://github.com/react-component/switch","bugs":{"url":"http://github.com/react-component/switch/issues"},"repository":{"type":"git","url":"git+ssh://git@github.com/react-component/switch.git"},"license":"MIT","main":"lib/index","module":"./es/index","scripts":{"compile":"father build && lessc assets/index.less assets/index.css","docs:build":"dumi build","docs:deploy":"gh-pages -d .doc","gh-pages":"npm run docs:build && npm run docs:deploy","lint":"eslint .","lint-staged":"lint-staged","prepare":"husky install && dumi setup","prepublishOnly":"npm run compile && rc-np","postpublish":"npm run gh-pages","start":"dumi dev","test":"umi-test"},"lint-staged":{"**/*.{js,jsx,tsx,ts,md,json}":["prettier --write"]},"dependencies":{"classnames":"^2.2.1","@rc-component/util":"^1.3.0"},"devDependencies":{"@rc-component/father-plugin":"^2.0.0","@types/classnames":"^2.2.10","@types/jest":"^29.4.0","@umijs/fabric":"^3.0.0","cheerio":"1.0.0-rc.12","dumi":"^2.0.0","enzyme":"^3.0.0","enzyme-adapter-react-16":"^1.0.1","enzyme-to-json":"^3.0.0","eslint":"^8.55.0","eslint-plugin-jest":"^27.6.0","eslint-plugin-unicorn":"^49.0.0","father":"^4.0.0","gh-pages":"^6.1.0","husky":"^8.0.1","less":"^4.1.3","lint-staged":"^15.1.0","@rc-component/np":"^1.0.3","prettier":"^3.1.0","react":"^16.0.0","react-dom":"^16.0.0","react-test-renderer":"^16.0.0","umi-test":"^1.9.7"},"peerDependencies":{"react":">=16.9.0","react-dom":">=16.9.0"},"_id":"@rc-component/switch@1.0.2","gitHead":"4b11bd712d2de7dbc6025e2a6f4024f6590685f5","types":"./lib/index.d.ts","_nodeVersion":"22.15.1","_npmVersion":"10.9.2","dist":{"shasum":"9f44dd22b2b9221d463f693175a39dfe3764c780","size":5113,"noattachment":false,"key":"/@rc-component/switch/-/@rc-component/switch-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@rc-component/switch/download/@rc-component/switch-1.0.2.tgz"},"_npmUser":{"name":"zombiej","email":"smith3816@gmail.com"},"directories":{},"maintainers":[{"name":"afc163","email":""},{"name":"chenshuai2144","email":""},{"name":"madccc","email":""},{"name":"peachscript","email":""},{"name":"zombiej","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/switch_1.0.2_1758263474389_0.27528493327654213"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-09-19T06:31:14.559Z","publish_time":1758263474559,"_source_registry_name":"default","_cnpm_publish_time":1758263474559},"1.0.1":{"name":"@rc-component/switch","version":"1.0.1","description":"switch ui component for react","keywords":["react","react-component","react-switch","switch"],"homepage":"http://github.com/react-component/switch","bugs":{"url":"http://github.com/react-component/switch/issues"},"repository":{"type":"git","url":"git+ssh://git@github.com/react-component/switch.git"},"license":"MIT","main":"lib/index","module":"./es/index","scripts":{"compile":"father build && lessc assets/index.less assets/index.css","docs:build":"dumi build","docs:deploy":"gh-pages -d .doc","gh-pages":"npm run docs:build && npm run docs:deploy","lint":"eslint .","lint-staged":"lint-staged","prepare":"husky install && dumi setup","prepublishOnly":"npm run compile && rc-np","postpublish":"npm run gh-pages","start":"dumi dev","test":"umi-test"},"lint-staged":{"**/*.{js,jsx,tsx,ts,md,json}":["prettier --write"]},"dependencies":{"classnames":"^2.2.1","@rc-component/util":"^1.3.0"},"devDependencies":{"@rc-component/father-plugin":"^2.0.0","@types/classnames":"^2.2.10","@types/jest":"^29.4.0","@umijs/fabric":"^3.0.0","cheerio":"1.0.0-rc.12","dumi":"^2.0.0","enzyme":"^3.0.0","enzyme-adapter-react-16":"^1.0.1","enzyme-to-json":"^3.0.0","eslint":"^8.55.0","eslint-plugin-jest":"^27.6.0","eslint-plugin-unicorn":"^49.0.0","father":"^4.0.0","gh-pages":"^6.1.0","husky":"^8.0.1","less":"^4.1.3","lint-staged":"^15.1.0","@rc-component/np":"^1.0.3","prettier":"^3.1.0","react":"^16.0.0","react-dom":"^16.0.0","react-test-renderer":"^16.0.0","umi-test":"^1.9.7"},"peerDependencies":{"react":">=16.9.0","react-dom":">=16.9.0"},"_id":"@rc-component/switch@1.0.1","gitHead":"8e2a58548048ad56a2ce322200796d41133a4379","types":"./lib/index.d.ts","_nodeVersion":"22.15.1","_npmVersion":"10.9.2","dist":{"shasum":"455dddb0549f2bb55b85ecc12e1716f96955a064","size":5112,"noattachment":false,"key":"/@rc-component/switch/-/@rc-component/switch-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@rc-component/switch/download/@rc-component/switch-1.0.1.tgz"},"_npmUser":{"name":"zombiej","email":"smith3816@gmail.com"},"directories":{},"maintainers":[{"name":"afc163","email":""},{"name":"chenshuai2144","email":""},{"name":"madccc","email":""},{"name":"peachscript","email":""},{"name":"zombiej","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/switch_1.0.1_1758006871045_0.5645737717504784"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-09-16T07:14:31.247Z","publish_time":1758006871247,"_source_registry_name":"default","_cnpm_publish_time":1758006871247},"1.0.0":{"name":"@rc-component/switch","version":"1.0.0","description":"switch ui component for react","keywords":["react","react-component","react-switch","switch"],"homepage":"http://github.com/react-component/switch","bugs":{"url":"http://github.com/react-component/switch/issues"},"repository":{"type":"git","url":"git+ssh://git@github.com/react-component/switch.git"},"license":"MIT","main":"lib/index","module":"./es/index","scripts":{"compile":"father build && lessc assets/index.less assets/index.css","docs:build":"dumi build","docs:deploy":"gh-pages -d .doc","gh-pages":"npm run docs:build && npm run docs:deploy","lint":"eslint .","lint-staged":"lint-staged","prepare":"husky install && dumi setup","prepublishOnly":"npm run compile && rc-np","postpublish":"npm run gh-pages","start":"dumi dev","test":"umi-test"},"lint-staged":{"**/*.{js,jsx,tsx,ts,md,json}":["prettier --write"]},"dependencies":{"classnames":"^2.2.1","@rc-component/util":"^1.2.0"},"devDependencies":{"@rc-component/father-plugin":"^2.0.0","@types/classnames":"^2.2.10","@types/jest":"^29.4.0","@umijs/fabric":"^3.0.0","cheerio":"1.0.0-rc.12","dumi":"^2.0.0","enzyme":"^3.0.0","enzyme-adapter-react-16":"^1.0.1","enzyme-to-json":"^3.0.0","eslint":"^8.55.0","eslint-plugin-jest":"^27.6.0","eslint-plugin-unicorn":"^49.0.0","father":"^4.0.0","gh-pages":"^6.1.0","husky":"^8.0.1","less":"^4.1.3","lint-staged":"^15.1.0","@rc-component/np":"^1.0.3","prettier":"^3.1.0","react":"^16.0.0","react-dom":"^16.0.0","react-test-renderer":"^16.0.0","umi-test":"^1.9.7"},"peerDependencies":{"react":">=16.9.0","react-dom":">=16.9.0"},"_id":"@rc-component/switch@1.0.0","gitHead":"86b71621b50571b176ceb5e1749d0c67d7384a3e","types":"./lib/index.d.ts","_nodeVersion":"22.5.1","_npmVersion":"10.8.2","dist":{"shasum":"5c6f3e1fbd0e4b4f5853f09605ed234be456d85a","size":5081,"noattachment":false,"key":"/@rc-component/switch/-/@rc-component/switch-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@rc-component/switch/download/@rc-component/switch-1.0.0.tgz"},"_npmUser":{"name":"zombiej","email":"smith3816@gmail.com"},"directories":{},"maintainers":[{"name":"afc163","email":""},{"name":"chenshuai2144","email":""},{"name":"madccc","email":""},{"name":"peachscript","email":""},{"name":"zombiej","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/switch_1.0.0_1739776772135_0.0633375629324846"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-02-17T07:19:32.311Z","publish_time":1739776772311,"_source_registry_name":"default","_cnpm_publish_time":1739776772311}},"readme":"# rc-switch\n\n---\n\nSwitch ui component for react.\n\n[![NPM version][npm-image]][npm-url]\n[![npm download][download-image]][download-url]\n[![build status][github-actions-image]][github-actions-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![bundle size][bundlephobia-image]][bundlephobia-url]\n\n[npm-image]: http://img.shields.io/npm/v/rc-switch.svg?style=flat-square\n[npm-url]: http://npmjs.org/package/rc-switch\n[travis-image]: https://img.shields.io/travis/react-component/switch/master?style=flat-square\n[travis-url]: https://travis-ci.com/react-component/switch\n[github-actions-image]: https://github.com/react-component/switch/workflows/CI/badge.svg\n[github-actions-url]: https://github.com/react-component/switch/actions\n[codecov-image]: https://img.shields.io/codecov/c/github/react-component/switch/master.svg?style=flat-square\n[codecov-url]: https://app.codecov.io/gh/react-component/switch\n[david-url]: https://david-dm.org/react-component/switch\n[david-image]: https://david-dm.org/react-component/switch/status.svg?style=flat-square\n[david-dev-url]: https://david-dm.org/react-component/switch?type=dev\n[david-dev-image]: https://david-dm.org/react-component/switch/dev-status.svg?style=flat-square\n[download-image]: https://img.shields.io/npm/dm/rc-switch.svg?style=flat-square\n[download-url]: https://npmjs.org/package/rc-switch\n[bundlephobia-url]: https://bundlephobia.com/package/rc-switch\n[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-switch\n\n## Install\n\n[![rc-switch](https://nodei.co/npm/rc-switch.png)](https://npmjs.org/package/rc-switch)\n\n## Usage\n\n```js\nimport Switch from 'rc-switch';\n\nexport default () => <Switch />;\n```\n\n## Compatibility\n\n| [<img src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png\" alt=\"IE / Edge\" width=\"24px\" height=\"24px\" />](http://godban.github.io/browsers-support-badges/)<br>IE / Edge | [<img src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png\" alt=\"Firefox\" width=\"24px\" height=\"24px\" />](http://godban.github.io/browsers-support-badges/)<br>Firefox | [<img src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png\" alt=\"Chrome\" width=\"24px\" height=\"24px\" />](http://godban.github.io/browsers-support-badges/)<br>Chrome | [<img src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png\" alt=\"Safari\" width=\"24px\" height=\"24px\" />](http://godban.github.io/browsers-support-badges/)<br>Safari | [<img src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/src/electron/electron_48x48.png\" alt=\"Electron\" width=\"24px\" height=\"24px\" />](http://godban.github.io/browsers-support-badges/)<br>Electron |\n| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| IE11, Edge                                                                                                                                                                                                     | last 2 versions                                                                                                                                                                                                  | last 2 versions                                                                                                                                                                                              | last 2 versions                                                                                                                                                                                              | last 2 versions                                                                                                                                                                                                      |\n\n## API\n\n| Property       | Type                     | Default   | Description                                              |\n| -------------- | ------------------------ | --------- | -------------------------------------------------------- |\n| prefixCls      | String                   | rc-switch |                                                          |\n| className      | String                   | ''        | additional class name of root node                       |\n| checked        | boolean                  | false     | whether switch is checked                                |\n| defaultChecked | boolean                  | false     | whether switch is checked on init                        |\n| onChange       | Function(checked, event) |           | called when switch is checked or unchecked               |\n| tabIndex       | number                   |           | tab-index of switch node                                 |\n| onClick        | Function(checked, event) |           | called when switch is clicked                            |\n| autoFocus      | boolean                  |           | get focus when mounts                                    |\n| disabled       | boolean                  | false     | whether switch is disabled                               |\n| loadingIcon    | React.ReactNode          |           | specific the extra node. generally used in loading icon. |\n\n## Development\n\n```\nnpm install\nnpm start\n```\n\nOnline demo: http://react-component.github.io/switch/\n\n## License\n\nrc-switch is released under the MIT license.\n","_attachments":{},"homepage":"http://github.com/react-component/switch","bugs":{"url":"http://github.com/react-component/switch/issues"},"license":"MIT"}