Pintch Switch
harshkanjiya/pintch-switchFreeComponent
A flat-track toggle with a raised pintch-style thumb.
Live preview
live · rendered by the registry
Rendered by harshkanjiya on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://harshkanjiya.com/r/pintch-switch.jsonSource
1'use client'23import { useSound } from '@/hooks/use-sound'4import React, { useState } from 'react'56export function PintchSwitch() {7 const [isOn, setIsOn] = useState(false)89 const toggle = () => setIsOn(p => !p)1011 const handleKeyDown = (e: React.KeyboardEvent) => {12 if (e.key === ' ' || e.key === 'Enter') {13 e.preventDefault()14 toggle()15 }16 }1718 const playClick = useSound("/audio/ui-sounds/toggle-2.mp3");1920 return (21 <button22 role="switch"23 aria-checked={isOn}24 onClick={() => {25 toggle();26 playClick();27 }}28 onKeyDown={handleKeyDown}29 className={[30 'relative flex items-center',31 'w-[120px] h-[46px] rounded-full',32 'cursor-pointer outline-none select-none',33 'focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-neutral-400',34 'bg-[#e8e8e8] dark:bg-[#151518]',35 'shadow-[inset_3px_3px_7px_rgba(0,0,0,0.09),inset_-2px_-2px_5px_rgba(255,255,255,0.8)]',36 'dark:shadow-[inset_3px_3px_7px_rgba(0,0,0,0.5),inset_-2px_-2px_5px_rgba(50,50,65,0.35)]',37 ].join(' ')}38 >39 {/* Left dot — visible when ON */}40 <span41 aria-hidden="true"42 className={[43 'pointer-events-none absolute left-[13px]',44 'w-[5px] h-[5px] rounded-full',45 'bg-[#a8b8c4] dark:bg-[#607a8c]',46 'transition-opacity duration-300',47 isOn ? 'opacity-60' : 'opacity-0',48 ].join(' ')}49 />5051 {/* Right dot — orange, visible when OFF */}52 <span53 aria-hidden="true"54 className={[55 'pointer-events-none absolute right-[13px]',56 'w-[5px] h-[5px] rounded-full',57 'bg-[#f05a00] dark:bg-[#ff6820]',58 'transition-opacity duration-300',59 isOn ? 'opacity-0' : 'opacity-100',60 ].join(' ')}61 />6263 {/* Thumb */}64 <span65 aria-hidden="true"66 className={[67 'pointer-events-none absolute top-[3px] left-[3px]',68 'flex items-center justify-center gap-[4px]',69 'px-[3px] h-[40px] rounded-full',70 'bg-[#e5e5e5] dark:bg-[#2a2a32]',71 'transition-transform duration-300 ease-in-out',72 // Light: strong white top-highlight + soft bottom shadow73 // Dark: replace white highlights with low-opacity light tint; keep the bottom shadow heavy74// … truncated
Files it writes
More from harshkanjiya
All 6 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Hello Worldhello-world | harshkanjiya | Components | Free | no deps · 2 files | |
| Realistic Buttonrealistic-button | harshkanjiya | Components | Free | no deps · 4 files | |
| Shutter CTAshutter-cta | harshkanjiya | Components | Free | no deps · 2 files | |
| Toggletoggle | harshkanjiya | Components | Free | no deps · 4 files |
