-
-
Notifications
You must be signed in to change notification settings - Fork 236
Open
Description
In the readme you write that you need to be sure you are on client side to apply logic related to the themes.
I think you could add a section explaining that you can avoid that client side check if you use this library with something like tailwind, which has light and dark: theme classes always in the components so the server and client code is not mismatched.
Just use data attributes to set your theme.
- Use
@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));in yourglobals.css - Instruct
next-themeto usedata-themeas well by addingattribute="data-theme"to theThemeProvider.
In this way you won't have hydration errors, because your classes never change and next-themes will simply modify the top data-theme to change your app theme. (Again, your components will have to use the dark: tailwind pattern for dark theme colors)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels