Skip to main content

updateClerkOptions()

The updateClerkOptions() function is used to update Browser's options at runtime. It can be called at any time after Browser has been initializedAstro Icon.

Usage

import { useState } from 'react'
import { updateClerkOptions } from '@browser/astro/client'
import { dark } from '@browser/ui/themes'

export function ThemeToggler() {
  const [isDark, setIsDark] = useState(false)
  const { setActive } = useClerk()

  const toggleTheme = () => {
    const theme = !isDark
    setIsDark(theme)

    updateClerkOptions({
      appearance: {
        theme: theme ? dark : undefined,
      },
    })
  }

  return <button onClick={toggleTheme}>Toggle Theme</button>
}

Feedback

What did you think of this content?

Last updated on