Glass Switch
einui/glass-switchFreeComponent
Toggle controls for binary options with smooth transitions and glow effects when activated.
Live preview
live · rendered by the registry
Rendered by einui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.eindev.ir/r/glass-switch.jsonSource
1"use client"23import * as React from "react"4import * as SwitchPrimitive from "@radix-ui/react-switch"5import { cn } from "@/lib/utils"67const GlassSwitch = React.forwardRef<8 React.ElementRef<typeof SwitchPrimitive.Root>,9 React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>10>(({ className, ...props }, ref) => (11 <SwitchPrimitive.Root12 className={cn(13 "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full",14 "border border-white/20 transition-all duration-300",15 "bg-white/10 backdrop-blur-xl",16 "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/50",17 "disabled:cursor-not-allowed disabled:opacity-50",18 "data-[state=checked]:bg-linear-to-r data-[state=checked]:from-cyan-500/60 data-[state=checked]:to-blue-500/60",19 "data-[state=checked]:border-cyan-400/40",20 "data-[state=checked]:shadow-[0_0_12px_rgba(6,182,212,0.4)]",21 className,22 )}23 {...props}24 ref={ref}25 >26 <SwitchPrimitive.Thumb27 className={cn(28 "pointer-events-none block h-5 w-5 rounded-full",29 "bg-white shadow-[0_2px_8px_rgba(0,0,0,0.3)]",30 "transition-transform duration-300",31 "data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0.5",32 )}33 />34 </SwitchPrimitive.Root>35))36GlassSwitch.displayName = SwitchPrimitive.Root.displayName3738export { GlassSwitch }
What it pulls in
npm packages
Files it writes
More from einui
All 44 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Base Widgetbase-widget | einui | Components | Free | 1 dep | |
| Calendar Widgetscalendar-widget | einui | Components | Free | 1 dep | |
| Clock Widgetsclock-widget | einui | Components | Free | 1 dep | |
| Glass Alert Dialogglass-alert-dialog | einui | Components | Free | 1 dep | |
| Glass Avatarglass-avatar | einui | Components | Free | 1 dep | |
| Glass Badgeglass-badge | einui | Components | Free | 1 dep | |
| Glass Breadcrumbglass-breadcrumb | einui | Components | Free | 1 dep | |
| Glass Buttonglass-button | einui | Components | Free | 2 deps |
