import clsx from 'clsx'; import React, { useRef } from 'react'; interface IToggle extends Pick, 'id' | 'name' | 'checked' | 'onChange' | 'required' | 'disabled'> { size?: 'sm' | 'md' } /** A glorified checkbox. */ const Toggle: React.FC = ({ id, size = 'md', name, checked, onChange, required, disabled }) => { const input = useRef(null); const handleClick: React.MouseEventHandler = (e) => { e.preventDefault(); input.current?.focus(); input.current?.click(); }; return ( ); }; export default Toggle;