Light & Dark Mode toggle using Tailwind CSS & Alpine JS

  Рет қаралды 5,899

Thirus

Thirus

Күн бұрын

This video shows you how to implement the toggle button to switch between light and dark mode for your website using Tailwind CSS & Alpine JS. The demo also includes "remembering" the users choice for the session.
GitHub Link: github.com/Thi...
--------
The video is sponsored by Showwcase. Join me there - www.showwcase....
--------
Subscribe and stay tuned for tips, tutorials and more.
Follow me on Twitter: / shrutibalasa
Follow Thirus on Twitter: / thirusofficial
Visit my website: www.shrutibala...

Пікірлер: 25
@mauriciovalencia7300
@mauriciovalencia7300 2 жыл бұрын
Such clear thinking and tutorials, thank you Shruti!
@Thirus
@Thirus 2 жыл бұрын
Thanks for the comment Mauricio 😊🙌
@kieran2347
@kieran2347 3 жыл бұрын
Yet another great video! Thanks, Shruti!
@Thirus
@Thirus 3 жыл бұрын
Welcome :)
@abusaadwachu2850
@abusaadwachu2850 3 жыл бұрын
Shurti has done it again...good work
@Thirus
@Thirus 3 жыл бұрын
Thank you!
@MilindGoel15
@MilindGoel15 2 жыл бұрын
Would we need to add this every page on our project? Like suppose we have 2 pages, we need all these in both those pages. And I think the dark mode value will continue to follow on next page too.
@Thirus
@Thirus 2 жыл бұрын
Yes, it needs to be on each page. And yes, the preference is saved.
@ris5281
@ris5281 2 жыл бұрын
Hi. i've got a problem. in localstorage the darkMode set to true, but whenever i reload the page the page gone light for some milisecond then get dark
@Thirus
@Thirus 2 жыл бұрын
Oh! Try this solution - stackoverflow.com/a/59628913 Haven’t tried it myself, but it might help.
@StefanSchmalhaus
@StefanSchmalhaus 9 ай бұрын
@@Thirus This Stackoverflow solution is a completely different approach and cannot be applied to your script. Maybe you can do a follow-up video on how to improve your solution.
@sornt
@sornt 3 жыл бұрын
Great!!
@govindsaini8085
@govindsaini8085 3 жыл бұрын
Hi mam I m facing the pb of display I want to show in lg screen of image and mobile devices I want to show hidden of image "hidden md:block " I used but doesn't work show this kind of pb how to solve mam if possible as soon as reply for this question
@Thirus
@Thirus 3 жыл бұрын
Have you tried inspecting the element in browser? You will have to share screenshots of your code for me to understand why it’s not working. DM me on Twitter @shrutibalasa
@hyunseokyang7032
@hyunseokyang7032 2 жыл бұрын
Thanks for the great tutorial! Awesome. Could you share how to keep darkmode(or light) over different page? becuase when I click other menu, it changed to light mode from dark. :-)
@Thirus
@Thirus 2 жыл бұрын
Hi, I’ve shown exactly that towards the end of the tutorial using localStorage.
@stephenlau2845
@stephenlau2845 2 жыл бұрын
Hi, Thanks for your sharing, How can I change my logo image when I use dark mode toggled ? Thanks again...!
@PriyanshuCK
@PriyanshuCK 2 жыл бұрын
Using Tailwind css: .\!logo-light { content: url("logo-light.png") !important; .dark .dark\:\!logo-dark { content: url("logo-dark.png") !important; }
@stephenlau2845
@stephenlau2845 2 жыл бұрын
@@PriyanshuCK Thank very much....!
@medcharrafi
@medcharrafi Жыл бұрын
u change my mind about women instructor
@Thirus
@Thirus Жыл бұрын
Interesting!
@mariooviedo4298
@mariooviedo4298 3 жыл бұрын
Hi, I hope you can help me, when I try to add to the switch button (or another type of button xd) it doesn't run and the console in the browser shows me this message "ReferenceError: isDark is not defined" :c I follow all of your instructions
@Thirus
@Thirus 3 жыл бұрын
I will need to look at your code to help. DM me on Twitter twitter.com/shrutibalasa
@mariooviedo4298
@mariooviedo4298 3 жыл бұрын
@@Thirus Thanks! I fixed it yesterday, I was trying to use an old version of AlpineJS haha thanks anyway, good video!
@Thirus
@Thirus 3 жыл бұрын
Great to know it’s solved :)
Minecraft Creeper Family is back! #minecraft #funny #memes
00:26
отомстил?
00:56
История одного вокалиста
Рет қаралды 7 МЛН
Amazing Parenting Hacks! 👶✨ #ParentingTips #LifeHacks
00:18
Snack Chat
Рет қаралды 21 МЛН
💩Поу и Поулина ☠️МОЧАТ 😖Хмурых Тварей?!
00:34
Ной Анимация
Рет қаралды 1,7 МЛН
Complete CSS Flexbox Tutorial using Tailwind CSS
38:17
Thirus
Рет қаралды 39 М.
You’re doing dark mode wrong!
7:54
Coding in Public
Рет қаралды 51 М.
Subgrid in Tailwind CSS - You didn’t know you needed this
14:12
Recreate Bootstrap Grid System in Tailwind CSS
24:55
Thirus
Рет қаралды 6 М.
Complete CSS Grid Tutorial using Tailwind CSS
46:41
Thirus
Рет қаралды 40 М.
Dark mode with TailwindCSS in under 7 minutes
6:58
Built With Code
Рет қаралды 36 М.
Alpine.js Crash Course
42:02
Traversy Media
Рет қаралды 124 М.
Tailwind CSS | Dark & Light Theme Switcher
8:54
John Komarnicki
Рет қаралды 65 М.
Minecraft Creeper Family is back! #minecraft #funny #memes
00:26