Last active
February 27, 2025 19:35
-
-
Save codigoconjuan/06a121af977ab79672cb0a0b1d89c66e to your computer and use it in GitHub Desktop.
Gist Switch para DevTree
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Switch | |
checked={item.enabled} | |
onChange={() => {}} | |
className={classNames( | |
item.enabled ? 'bg-blue-500' : 'bg-gray-200', | |
'relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2' | |
)} | |
> | |
<span | |
aria-hidden="true" | |
className={classNames( | |
item.enabled ? 'translate-x-5' : 'translate-x-0', | |
'pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out' | |
)} | |
/> | |
</Switch> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function classNames(...classes : string[]) { | |
return classes.filter(Boolean).join(' ') | |
} |
quite interesting this lib!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
uwu arigato gozaimasu :)