A favicon of React Fancy Switch

React Fancy Switch

A customizable React component for creating elegant, interactive multi-option switches. Features flexible styling, accessibility, and smooth transitions without framer-motion.

A screenshot of React Fancy SwitchVisit

React Fancy Switch: Customizable and Accessible Multi-Option Component

React Fancy Switch is a versatile React component enabling developers to implement elegant and interactive multi-option selectors. It supports diverse option types, from simple primitives to complex objects, and offers extensive customization for styling and behavior. Designed for easy integration and accessibility, it enhances user interfaces with smooth transitions and responsive interactions, all achieved without relying on external animation libraries like framer-motion, making it a lightweight yet powerful choice for modern applications.

Features:

  • Versatile Option Support: Handles primitive (string, number, boolean) and object-based option arrays.
  • Deep Styling Customization: Apply custom CSS classes to the container, individual radio buttons, and the selection highlighter.
  • Accessibility Focused: Implements ARIA attributes, keyboard navigation (arrow keys), and focus management for inclusive UIs.
  • Smooth Transition Effects: Delivers fluid visual feedback during option selection without external animation libraries.
  • Custom Option Rendering: Provides a renderOption prop for complete control over how each option is displayed.
  • Flexible Object Key Configuration: Allows custom valueKey, labelKey, and disabledKey for object-based options.
  • Highlighter Styling Control: Customize highlighter appearance via highlighterClassName, highlighterStyle, and highlighterIncludeMargin.
  • Individual Option Disabling: Supports disabling specific options through a disabledOptions array or a property in object options.
  • No Framer Motion Dependency: Lightweight animations built-in, avoiding the need for framer-motion.
  • Easy Integration & Usage: Simple installation via npm and straightforward API for quick implementation.
  • Screen Reader Compatibility: Includes a live region for announcements, enhancing usability for visually impaired users.

Summary:

React Fancy Switch provides developers with a robust solution for creating sophisticated multi-option selection UIs in React. It emphasizes customization, allowing for tailored styling and behavior to fit any application design. With built-in accessibility features, smooth animations, and support for various data structures, it simplifies the development of interactive and user-friendly switch components without adding external dependencies, offering a polished experience for end-users.

Distribution:
opensource
GitHub:
196 Stars
5 Forks
Share:

 

  
 

Similar to React Fancy Switch:

 

  
  

 

  
  

 

  
  
React Fancy Switch: Elegant, interactive React switch for versatile multi-option selection. – Awesome-Shadcn/ui