# switch **Repository Path**: mirrors_react-component/switch ## Basic Information - **Project Name**: switch - **Description**: React Switch - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-18 - **Last Updated**: 2025-06-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # rc-switch --- Switch ui component for react. [![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Test coverage][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [npm-image]: http://img.shields.io/npm/v/rc-switch.svg?style=flat-square [npm-url]: http://npmjs.org/package/rc-switch [travis-image]: https://img.shields.io/travis/react-component/switch/master?style=flat-square [travis-url]: https://travis-ci.com/react-component/switch [github-actions-image]: https://github.com/react-component/switch/workflows/CI/badge.svg [github-actions-url]: https://github.com/react-component/switch/actions [codecov-image]: https://img.shields.io/codecov/c/github/react-component/switch/master.svg?style=flat-square [codecov-url]: https://app.codecov.io/gh/react-component/switch [david-url]: https://david-dm.org/react-component/switch [david-image]: https://david-dm.org/react-component/switch/status.svg?style=flat-square [david-dev-url]: https://david-dm.org/react-component/switch?type=dev [david-dev-image]: https://david-dm.org/react-component/switch/dev-status.svg?style=flat-square [download-image]: https://img.shields.io/npm/dm/rc-switch.svg?style=flat-square [download-url]: https://npmjs.org/package/rc-switch [bundlephobia-url]: https://bundlephobia.com/package/rc-switch [bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-switch ## Install [![rc-switch](https://nodei.co/npm/rc-switch.png)](https://npmjs.org/package/rc-switch) ## Usage ```js import Switch from 'rc-switch'; export default () => ; ``` ## Compatibility | [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | [Electron](http://godban.github.io/browsers-support-badges/)
Electron | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions | ## API | Property | Type | Default | Description | | -------------- | ------------------------ | --------- | -------------------------------------------------------- | | prefixCls | String | rc-switch | | | className | String | '' | additional class name of root node | | checked | boolean | false | whether switch is checked | | defaultChecked | boolean | false | whether switch is checked on init | | onChange | Function(checked, event) | | called when switch is checked or unchecked | | tabIndex | number | | tab-index of switch node | | onClick | Function(checked, event) | | called when switch is clicked | | autoFocus | boolean | | get focus when mounts | | disabled | boolean | false | whether switch is disabled | | loadingIcon | React.ReactNode | | specific the extra node. generally used in loading icon. | ## Development ``` npm install npm start ``` Online demo: http://react-component.github.io/switch/ ## License rc-switch is released under the MIT license.