
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
Switch ui component for react.
import Switch from 'rc-switch';
export default () => <Switch />;
![]() IE / Edge | ![]() Firefox | ![]() Chrome | ![]() Safari | ![]() Electron |
|---|---|---|---|---|
| IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
| 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. |
npm install
npm start
Online demo: http://react-component.github.io/switch/
rc-switch is released under the MIT license.
react-switch is a similar package that provides a component for rendering switch inputs in React applications. It offers a different API and additional customization options compared to rc-switch, such as different sizes and colors.
react-toggle offers functionality similar to rc-switch, with a focus on creating toggle switches for React apps. It differentiates itself with a more extensive API for customization, including custom icons for the toggle states.
FAQs
switch ui component for react
The npm package rc-switch receives a total of 2,068,144 weekly downloads. As such, rc-switch popularity was classified as popular.
We found that rc-switch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.