-
Notifications
You must be signed in to change notification settings - Fork 24
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 to update component appearance on the fly #69
Comments
Using the {#key} block to force a re-render of the Clerk components when the mode changes is an effective way to ensure the theme updates properly.
This solution works because:
It's a useful technique to keep in mind for situations where you need to ensure a component fully re-renders with new props, especially when working with third-party components that might not be as reactive as native Svelte components. |
Waiting for this PR to get merged, but you can do this later: import { neobrutalism, dark } from '@clerk/themes'
import { useClerkContext } from 'clerk-sveltekit/client'
const { clerk } = useClerkContext()
$clerk?.__unstable__updateProps({ appearance: { baseTheme: neobrutalism } })
// or directly call Clerk from window (maybe you can do this right now, not sure)
window.Clerk.__unstable__updateProps({ appearance: { baseTheme: neobrutalism } }) |
I would prefer to have all my appearance in just one place, thats why I put them in the |
Awesome. So this means that when that PR is merged we could update the appearance of all the clerk components in just one place? |
Yes! |
I have set the components appearance in the client.hooks.ts but this means that whenever I change the theme on the page it doesn't reflect on the clerk ui components and a refresh is necessary to update the appearance. Is there a way to somehow do this?
The text was updated successfully, but these errors were encountered: