Skip to main content
Version: 1.0.3

Switch

The Switch component is a toggleable form control built on top of Radix UI's Switch Primitive, enhanced with beautiful animations using Framer Motion. It provides a user-friendly way to toggle between two states with smooth transitions and various visual styles.

Installation

ignix add component switch

Usage

Import the component:

import { Switch } from '@ignix-ui/switch';

Basic Usage

function BasicSwitch() {
return <Switch defaultChecked />;
}

Props

PropTypeDefaultDescription
variant'default' | 'large' | 'small' | 'pill' | 'square' | 'slim' | 'ios' | 'material''default'Visual style of the switch
animation'default' | 'bounce' | 'scale' | 'rotate' | 'fade' | 'elastic' | 'pulse' | 'shake' | 'flip' | 'jelly' | 'glow''default'Animation applied to the thumb when toggling
glowEffectbooleanfalseWhen true, renders an animated radial glow behind the switch when checked
thumbClassNamestring-Additional Tailwind classes applied to the thumb element
classNamestring-Additional Tailwind classes applied to the root switch element