{"library":"rc-switch","title":"React Switch UI Component","description":"rc-switch is an unstyled, highly customizable switch (toggle) UI component for React applications, providing fundamental functionality without imposing visual opinions. The package provided here, `rc-switch`, reached its last major release at version 4.1.0. Since then, development and new features have continued under a new scoped package name, `@rc-component/switch`, which currently stands at version 1.0.3. This library is part of the `react-component` ecosystem, known for delivering foundational, barebones UI elements designed for maximum stylistic flexibility. It emphasizes broad browser compatibility and a minimal bundle size, making it suitable for integration into custom design systems. Releases for the original `rc-switch` package have ceased, with all active development now occurring in its successor package, `@rc-component/switch`.","language":"javascript","status":"renamed","last_verified":"Sun Apr 19","install":{"commands":["npm install rc-switch"],"cli":null},"imports":["import Switch from 'rc-switch';","import type { SwitchProps } from 'rc-switch';","import Switch, { SwitchProps } from 'rc-switch';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import Switch from 'rc-switch';\nimport React from 'react';\n\nconst MySwitchComponent = () => {\n  const [checked, setChecked] = React.useState(false);\n\n  const handleChange = (newChecked) => {\n    console.log('Switch toggled:', newChecked);\n    setChecked(newChecked);\n  };\n\n  return (\n    <div>\n      <p>My Custom Switch:</p>\n      <Switch\n        checked={checked}\n        onChange={handleChange}\n        checkedChildren=\"ON\"\n        unCheckedChildren=\"OFF\"\n        className=\"my-custom-switch\"\n        style={{ backgroundColor: checked ? '#1890ff' : '#bfbfbf' }}\n      />\n      <p>Current state: {checked ? 'Enabled' : 'Disabled'}</p>\n    </div>\n  );\n};\n\nexport default MySwitchComponent;","lang":"typescript","description":"Demonstrates basic usage of the Switch component, including state management for controlled usage and custom styling.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}