Thanks man, that transition part is a cherry on top
@fulviavaz10 ай бұрын
Amazing! Your solution is much simpler that I was trying! Thanks!
@ethan.creates Жыл бұрын
Dope video man! Loved the transition tip and everything else was very clear!
@lestratege427 күн бұрын
Thank You man , simple , easy, straight to the point, dont talk too much and give what the title of the video said... thx again man...
@razeku13322 ай бұрын
Best tutorial i saw been 4 times watching same tutorial still doenst understand,, but this amazing thanks man
@the.mackuha Жыл бұрын
Straight to the point! Thanks man🔥
@builtwithcode Жыл бұрын
Thanks for watching, glad it was helpful!
@dr.insane99299 ай бұрын
Thanks brotha, The transition was a lifesaver.
@bryan_110165 ай бұрын
Thanks a lot mate. I was struggling with Dark mode in Tailwind and you made it look simple. Appreciate it👍❤
@nisargjaiswal4264 Жыл бұрын
Suggestion for video: Keep mobile users in mind, so zoom in the code for better readability. Nice video, keep it up buddy ✌️
@builtwithcode Жыл бұрын
Thanks for the callout, will try to zoom in more in the future.
@masoodacheampong53858 ай бұрын
Thank you very much, at the end, I knew you would use useState to handle the transition, so I did mine just like that.
@felipepadovani626311 ай бұрын
Excellent dude !! helped me a lot
@vladanisov1689 Жыл бұрын
This was incredibly helpful, thank you my man!
@builtwithcode Жыл бұрын
Glad to hear it!
@DEBUGENTITY Жыл бұрын
Loved this video.. Thanks for making this🎉
@chadvise33086 ай бұрын
This was so helpful thanks for the content ❤
@AndrewDBrown2020Ай бұрын
Perfect - thank you.
@AmanMarve-ge3mdАй бұрын
Great Video 🔥
@francesco_gramazio8 ай бұрын
freaking awesome, thanks mate !
@sybrespect316111 ай бұрын
you just got a new subscriber 👍🏾
@angeline955211 ай бұрын
This is so helpful, thank u :)
@iamabishekbaiju8 ай бұрын
Excellent tutorial. thanks a lot
@builtwithcode7 ай бұрын
Glad it was helpful!
@davonne007 Жыл бұрын
Definitely doing this .,.!!
@musicworld171711 ай бұрын
it helped me immensly..thanks bro
@killiankavanagh385411 ай бұрын
Thanks so much man
@akshaykumar-xu2be11 ай бұрын
Thanks bro. 💯Worth watching . just SUBSCRIBED
@builtwithcode11 ай бұрын
Glad it was helpful!
@nested93017 ай бұрын
oh tailwind is awesome !!
@Jishanthegodev11 ай бұрын
Top notch content❤
@aldrinwong61603 ай бұрын
simple! this helps!
@moistmangomilkshake347Ай бұрын
THANK YOU
@TOONSSTATION6 ай бұрын
Nice
@MostaFathi110 күн бұрын
There is a problem when I switch to any mode, the coloring of the texts is delayed by a greater percentage than the rest. If the range is 300, the texts will appear to be colored within 700, and this is strange. This problem only appears in the Chrome browser and the Firefox browser. Things are great there unlike Chrome.
@saifullahkhan268513 күн бұрын
woooohooooooo
@AnkitKumar-dy5um9 ай бұрын
That's super easy :)
@TusharVerma-i1k3 ай бұрын
i created this button in navbar , now i am using this navbar in every component but the color is changing only in navbar not everywhere, how to solve this?
@deelaka-245 ай бұрын
thank u ❤
@adityarajawat3185 Жыл бұрын
Nice explanation
@builtwithcode Жыл бұрын
Thanks!
@alexdin15657 ай бұрын
thanks bro please can you make your video about "Custom themes with TailwindCSS in under 9 minutes" with this ? i mean user can switch thems and change from dark and light in same time
@tutopoints19208 ай бұрын
Nice One
@saixcode4 ай бұрын
thanks
@chan4est8 ай бұрын
Super helpful! I'm curious how you handle both use cases at once. Basically using the user's preferred theme during first site use but once the user chooses their preferred theme, it overrides their OS's preference upon every revisit. Also how do you handle images that need to be swapped out in dark mode?
@builtwithcode8 ай бұрын
You'll want to store the preferred theme in localStorage. If you see that the storage is empty, then default to the OS preference. For images, I imagine the best way is to have the theme stored in some sort of global state (e.g., with React Context), then dynamically set the img src based on which theme is active.
@lawalmuktair5617Ай бұрын
❤
@ahrenwagner29937 ай бұрын
Great video :) Is there a way to do this without needing to prefix dark in your markup?
@builtwithcode7 ай бұрын
The prefix is how tailwind recognizes which styles to apply in light vs dark mode. You could leverage a "non-Tailwind" approach using CSS variables and the prefers-color-scheme CSS selector. At that point I just prefer the "dark" prefix :)
@K4NEKIIIIa4 ай бұрын
how we can make the navbar dark mode on all the pages??
@AhmedMohamed-hz9bs9 ай бұрын
❤❤❤❤
@tasfin6608 ай бұрын
for some reason after writing * { @apply transition-colors duration-200; } this, all my other transition duration not working
@nonefvnfvnjnjnjevjenjvonej33848 ай бұрын
so how does tailwind get the dark mode actually. does it set it to dark on the html element?
@abhishekchaudhary405810 ай бұрын
Thanks
@sad_man_no_talent6 ай бұрын
thx
@Kyruu288 ай бұрын
So instead of using text, I chose to use icons for the toggle instead. I wonder how to add transition for the toggle icon so it can fade or spin etc. ? I've tried added transition class to the icon element but it doesn't work...
@builtwithcode8 ай бұрын
Framer Motion would help here to animate when one icon unmounts and another comes into view
@lolhp._.8 ай бұрын
anyone know how to do the same thing but for the html tag?
@rayudubharani8 ай бұрын
sir what about system default
@cabaucom376 Жыл бұрын
What if you wanted a dropdown menu for “system”, “dark”, “light”? I would like system to be the default but if someone specifies then update accordingly.
@builtwithcode Жыл бұрын
The system value is stored in the `prefers-color-scheme` CSS property. In TS/JS you can check if it's dark using `window.matchMedia('(prefers-color-scheme: dark)').matches`
@martinfriday54819 ай бұрын
I created a button component and applied this dark and light mode to it, but when I call the component in another component and write "dark" styles, it doesn't work, is there any way around this??
@builtwithcode8 ай бұрын
Did you setup dark mode in the tailwind config?
@martinfriday54818 ай бұрын
@@builtwithcode yea, I did everything there, but the dark mode only applied to that button component and when I exported it to a page, it didn't affect the rest of the page
@builtwithcode8 ай бұрын
Are you applying the “dark” class to the root body or html tag? Tailwind should then enable dark mode for all the children
@martinfriday54818 ай бұрын
@@builtwithcode I should add the dark class to the HTML?
@martinfriday54818 ай бұрын
@@builtwithcode Then how will my button component toggle the dark mode on and off on button click, that's the issue
@ahmedahmedx960010 ай бұрын
What if i want also the darkmode got saved in browser when toggling the button so if its still darkmode even when page refreshed
@builtwithcode9 ай бұрын
You can store the active theme in local storage and read it on page load
@nested93017 ай бұрын
cookies + server side rendering
@qotibamhamed6467 Жыл бұрын
I'm experiencing an issue where, when I switch to light mode in my system, dark mode functions perfectly. However, when I enable dark mode in my system, the toggle between dark mode and light mode doesn't work. Can someone please assist me with this problem? (I replicated your steps exactly for importing dark mode in Tailwind.)
@builtwithcode Жыл бұрын
Hmm that's odd. Did you update the Tailwind config file to use "class" for dark mode functionality?
@angeline955211 ай бұрын
how would you implement a site-wide light/dark mode toggle?
@builtwithcode10 ай бұрын
Store the state in the main App component, then apply the "dark" class in the or at the top App level.
@martinfriday54819 ай бұрын
How??? I created a button component that I want to reuse across the site, how do I make it toggle the whole thing
@userre8510 ай бұрын
Which VS code theme are you using?
@builtwithcode9 ай бұрын
"Dark Modern" that comes with vscode
@anonymoussloth6687 Жыл бұрын
Could u do a video with dark mode using css variables - which could be extended to multiple themes
@builtwithcode Жыл бұрын
Thanks for the suggestion, I'll consider it for a future video.
@DrJake-dl7rg10 ай бұрын
what if we want to refresh the page?
@builtwithcode10 ай бұрын
You would need to persist the state in storage, e.g., using LocalStorage.
@DrJake-dl7rg10 ай бұрын
@@builtwithcode yeah thanks for replying! I'm having a rough time connecting the react state and Local Storage properly and couldn't find a good tutorial about that, yours was good tho.
@MyGeorge1964 Жыл бұрын
Is there is way to abstract all of the dark mode css to the tailwind config and maybe the stylesheet so that you only need to specify one variable in the html or jsx that will change depending on whether it's dark or light?
@builtwithcode Жыл бұрын
Yes you can definitely do this. One way is to use reusable components so you add the light and dark mode classes once in the component definition and have multiple instances. The other is in the stylesheet you can use the @apply declaration and directly use the appropriate tailwind classes in CSS.
@itsyurey3 ай бұрын
the problem with this is when you set to darkmode then you refresh the page then it will back to light
@builtwithcode3 ай бұрын
One way around this is to store the active theme in local storage. Then every time you load the page read from there to initialize the theme.
@kruthiks54004 ай бұрын
Thank you man
@mhalwasoffice61325 ай бұрын
how can i share this useState betwen the componants
@builtwithcode5 ай бұрын
If you want to share across multiple components, consider using state management such as React Context and storing the theme information there
@mhalwasoffice61325 ай бұрын
@@builtwithcode ty
@maeel11 ай бұрын
can i have a list of every vs code extension do you have for react?
@builtwithcode11 ай бұрын
The main ones I use in my workflow: - ES7+ React/Redux/React-Native snippets - Tailwind CSS IntelliSense - Prettier - Code formatter - Error Lens
@maeel11 ай бұрын
thanks a lot @@builtwithcode
@pastiille746710 ай бұрын
merci
@daniali4619 Жыл бұрын
Can its change multiple pages mood, i means if we set toggle btn in nav bar then how to change multiple pages dark mood i think then its not work, I'm right or not ?
@builtwithcode Жыл бұрын
For using across an entire website, you'll want to setup a React Context that stores the theme value, and then wrap the entire app in that context's provider. You then connect the toggle button to update the value in the context, which will propagate to other pages.
@rishabhagrawal8938 Жыл бұрын
How to add one condition inside an another condition like inside dark want to add another condition . Please help it is urgent or please share Where I can talk to yo
@builtwithcode Жыл бұрын
What type of other condition? If it's something stored in a component variable, then in the styling class names you can use a ternary operator with the variable and use the "dark" prefixing to limit the styling to dark mode.
@deylerdeyler640111 ай бұрын
does this work on next 13?
@builtwithcode11 ай бұрын
Yes this should work on Next 13
@01dom5 ай бұрын
Not good to be honest, would be better to define colors and change them with css so you wouldn't have to write dark everywhere
@danishnazirpeer34225 ай бұрын
That's what i was thinking when i clicked the video. Instead we got the most basic approach.
@arupde6320 Жыл бұрын
be regular
@haha-eg8fj Жыл бұрын
In my case I don’t need to give my document a dark class name and it just works after I confige tailwind.config.ts. I don’t know why.