This component requires the FyskProvider. See Quick Start →
Preview
Installation
Usage
Examples
Default
Standard switch with a label.
Variants & Sizes
Explore different shapes like square or line across multiple sizes.
Features
Aesthetic Variants: Supports classic rounded, modern square, glassmorphism, and a redesigned minimalist
linevariant.Status Integration: Built-in support for
loading,success, anderrorstates with animated icons and themed tracks.Consistent Scaling: Perfectly tuned sizes from
xstoxlthat align with the rest of the Fysk library.Motion Feedback: Uses Framer Motion for layout transitions and icon-popping feedback during state changes.
Accessible: Built on Radix Switch for proper ARIA roles and keyboard interaction.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "normal" | "square" | "line" | "glass" | "normal" | The visual shape/style of the switch. |
size | "default" | "xs" | "sm" | "md" | "lg" | "xl" | "default" | The size of the switch. |
state | "idle" | "loading" | "success" | "error" | "idle" | The current interaction state. |
Accepts all standard props from Radix UI Switch.