Last active
October 23, 2022 14:15
-
-
Save sjones6/6ef3e5754abf4c5f865acdf9b5d0f334 to your computer and use it in GitHub Desktop.
A darkmode toggle using tailwindcss
This file contains 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
<div class="w-14 h-8"> | |
<input type="checkbox" id="dark-mode-toggle" class="hidden" onchange="document.documentElement.classList.toggle('dark')" /> | |
<label for="dark-mode-toggle" class="w-full h-full bg-gray-800 dark:bg-white rounded-full p-1 flex justify-between cursor-pointer"> | |
<span class="inline dark:hidden">๐</span> | |
<span class="w-6 h-6 rounded-full bg-white dark:bg-gray-800 block float-right dark:float-left"></span> | |
<span class="hidden dark:inline">๐</span> | |
</label> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for the head start, this is what i did in Vue 3: