Skip to content

Modifying ChakraProvider to prevent theme collisions #2238

Answered by masenf
ZaneH asked this question in Q&A
Discussion options

You must be logged in to vote

If you can wait for our next release, this can be accomplished without a lot of code.

import reflex.components.libs.chakra

reflex.components.libs.chakra.chakra_provider.theme = rx.Var.create_safe({})
reflex.components.libs.chakra.chakra_provider.special_props.add(
    rx.Var.create_safe("resetCSS={true}"),
)

which generates code in the _app.js file like

function AppWrap({children}) {


  return (
    <ChakraProvider theme={{}} resetCSS={true}>
      <Global styles={GlobalStyles}/>
      <ChakraColorModeProvider>
        <Fragment>
          {children}
        </Fragment>
      </ChakraColorModeProvider>
   </ChakraProvider>
  )
}

try it out on reflex==0.3.5a2

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ZaneH
Comment options

@kumaraguru1735
Comment options

Answer selected by ZaneH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants