Skip to content

v4.0.0

Choose a tag to compare

@github-actions github-actions released this 28 Apr 15:26
· 93 commits to main since this release

Full rewrite. See UPGRADE.md for migration steps from v3.

Breaking

  • Drops React 16/17 support. Now requires react >= 18 (peer).
  • Removes the styled-components peer 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 controlled prop. Pass checked for controlled, defaultChecked for uncontrolled (matches native React form-input convention).
  • Deprecates onLeft / onRight / onToggle. Use onCheckedChange(checked, event) (recommended) or the standard onChange(event).

Added

  • role="switch" and proper ARIA wiring (aria-label, aria-labelledby, aria-describedby).
  • forwardRef correctly forwards to the underlying <input>.
  • Dual ESM + CJS build with full TypeScript declarations.
  • prefers-reduced-motion is respected.
  • Live playground built with Ladle, deployed to GitHub Pages.

Changed

  • Build output moved from committed dist/ (TypeScript-compiled CommonJS) to a tsup-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.