updateClerkOptions()
The updateClerkOptions()
function is used to update Clerk's options at runtime. It can be called at any time after Clerk has been initialized.
Usage
import { useState } from 'react'
import { updateClerkOptions } from '@clerk/astro/client'
import { dark } from '@clerk/themes'
export function ThemeToggler() {
const [isDark, setIsDark] = useState(false)
const { setActive } = useClerk()
const toggleTheme = () => {
const theme = !isDark
setIsDark(theme)
updateClerkOptions({
appearance: {
baseTheme: theme ? dark : undefined,
},
})
}
return <button onClick={toggleTheme}>Toggle Theme</button>
}
- Name
appearance
- Type
Appearance | undefined
- Description
Optional object to style your components. Will only affect Clerk components and not Account Portal pages.
- Name
localization
- Type
Localization | undefined
- Description
Optional object to localize your components. Will only affect Clerk components and not Account Portal pages.
Feedback
Last updated on