Get started with react-ios-switch CDN

MIT licensed

React-ios-switch is a React library providing an iOS-style toggle switch component.

Tags:
  • react
  • react-component
  • switch
  • toggle

Stable version

Copied!

How to start using react-ios-switch CDN


import React from 'react';
import IOSwitch from 'react-ios-switch';

const SwitchComponent = () => {
  const [isSwitched, setIsSwitched] = React.useState(false);

  const handleSwitchChange = (checked) => {
    setIsSwitched(checked);
  };

  return (
    <div>
      <IOSwitch
        onValueChange={handleSwitchChange}
        checked={isSwitched}
        iOSSwitchStyle={{ marginVertical: 10 }}
      />
      <p>Switch is {isSwitched ? 'ON' : 'OFF'}</p>
    </div>
  );
};

// Replace the script tag in your JSX file with the following line:
// <script src="https://cdn.cdnhub.io/react-ios-switch/0.1.19/bundle.js" />
// With this component instead:

export default SwitchComponent;
Copied!

All versions