Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do i provide theme value to clerkProvider that wraps ThemeProvider? #207

Open
facinick opened this issue Aug 26, 2023 · 1 comment
Open

Comments

@facinick
Copy link

Here is the code: right now I am hard coding "dark: as appreance value to clerkProvider, how do i dyamically set it based on what next-themes provides?

export default function RootLayout({ children }: { children: React.ReactNode }) {

  return (
    <ClerkProvider appearance={{
      baseTheme: dark
    }}>
      <html suppressHydrationWarning>
        <head />
        <body>
          <Providers>{children}</Providers>
        </body>
      </html>
    </ClerkProvider>
  )
}
@ram33z
Copy link

ram33z commented Aug 29, 2023

I was into similar situation where i had to pass theme value to another provider, One way I found is to read the value directly from local-storage

const currentTheme = localStorage.getItem("theme") || "light";

If you are using ThemeProviderProps then you can use themeProps?.storageKey to get the localStorage key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants