Glass Switch
washiveil/glass-switchFreeComponent
Toggle switch — ruri track when on, glass thumb, built on Radix Switch.
Install it
npx shadcn@latest add https://washiveil.alexchih.com/r/glass-switch.jsonSource
1'use client'23import * as React from 'react'4import { Switch as SwitchPrimitive } from 'radix-ui'56import { cn } from '@/lib/utils'78const GlassSwitch = React.forwardRef<9 React.ComponentRef<typeof SwitchPrimitive.Root>,10 React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>11>(({ className, ...props }, ref) => (12 <SwitchPrimitive.Root13 className={cn(14 'peer inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full border border-transparent bg-input transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-ruri dark:data-[state=checked]:bg-ruri-soft',15 className,16 )}17 {...props}18 ref={ref}19 >20 <SwitchPrimitive.Thumb21 className={cn(22 'pointer-events-none block size-5 rounded-full bg-background shadow ring-0 dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-deep transition-transform data-[state=checked]:translate-x-[17px] data-[state=unchecked]:translate-x-px',23 )}24 />25 </SwitchPrimitive.Root>26))27GlassSwitch.displayName = SwitchPrimitive.Root.displayName2829export { GlassSwitch }
What it pulls in
npm packages
Other registry items
Files it writes
More from washiveil
All 58 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Ambient Fieldambient-field | washiveil | Components | Free | no deps | |
| Chipchip | washiveil | Components | Free | 1 dep | |
| Code Badgecode-badge | washiveil | Components | Free | no deps | |
| Glass Accordionglass-accordion | washiveil | Components | Free | 2 deps | |
| Glass Alertglass-alert | washiveil | Components | Free | 1 dep | |
| Glass Alert Dialogglass-alert-dialog | washiveil | Components | Free | 1 dep | |
| Glass Aspect Ratioglass-aspect-ratio | washiveil | Components | Free | 1 dep | |
| Glass Avatarglass-avatar | washiveil | Components | Free | 1 dep |
