v4.0.0
Full rewrite. See UPGRADE.md for migration steps from v3.
Breaking
- Drops React 16/17 support. Now requires
react >= 18(peer). - Removes the
styled-componentspeer dependency. Theming uses standard CSS custom properties; the bundled stylesheet must be imported once:import "react-toggle-component/styles.css". - Removes
ReactToggleThemeProvider. Override CSS variables on any selector to scope a theme. - Removes the
controlledprop. Passcheckedfor controlled,defaultCheckedfor uncontrolled (matches native React form-input convention). - Deprecates
onLeft/onRight/onToggle. UseonCheckedChange(checked, event)(recommended) or the standardonChange(event).
Added
role="switch"and proper ARIA wiring (aria-label,aria-labelledby,aria-describedby).forwardRefcorrectly forwards to the underlying<input>.- Dual ESM + CJS build with full TypeScript declarations.
prefers-reduced-motionis respected.- Live playground built with Ladle, deployed to GitHub Pages.
Changed
- Build output moved from committed
dist/(TypeScript-compiled CommonJS) to atsup-generated dual-format bundle, no longer committed. - Documentation site moved from Docz/Gatsby (abandoned) to Ladle.
- Linter switched from tslint (deprecated) to ESLint flat config.