Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-switch

Package Overview
Dependencies
Maintainers
7
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-switch

switch ui component for react

  • 4.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3M
decreased by-7.27%
Maintainers
7
Weekly downloads
 
Created

What is rc-switch?

The rc-switch npm package is a React component library for creating switch (toggle) inputs. It allows developers to easily implement switch components in their React applications, providing both visual and functional customization options.

What are rc-switch's main functionalities?

Basic switch

This code sample demonstrates how to render a basic switch component using the rc-switch package. It imports the Switch component from the package and includes it in a React component to be displayed.

import React from 'react';
import Switch from 'rc-switch';

function App() {
  return (
    <Switch />
  );
}

export default App;

Customized switch

This example shows how to customize a switch by adding labels for the checked and unchecked states, and setting the default state to checked. The 'checkedChildren' and 'unCheckedChildren' props allow for custom labels, while 'defaultChecked' initializes the switch in the on position.

import React from 'react';
import Switch from 'rc-switch';

function App() {
  return (
    <Switch
      checkedChildren="on"
      unCheckedChildren="off"
      defaultChecked
    />
  );
}

export default App;

Other packages similar to rc-switch

Keywords

FAQs

Package last updated on 23 Apr 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc