"use client"; import { cn } from "@/shared/utils/cn"; export default function Toggle({ checked = false, onChange, label, description, disabled = false, size = "md", className, }) { const sizes = { sm: { track: "w-8 h-4", thumb: "size-3", translate: "translate-x-4", }, md: { track: "w-11 h-6", thumb: "size-5", translate: "translate-x-5", }, lg: { track: "w-14 h-7", thumb: "size-6", translate: "translate-x-7", }, }; const handleClick = () => { if (!disabled && onChange) { onChange(!checked); } }; return (
{(label || description) && (
{label && ( {label} )} {description && ( {description} )}
)}
); }