How to add a ThemeProvider to bit.dev

485 Views Asked by At

I'm starting a new UI-library with bit.dev

However I can't find any information or docs on how to add a "global" Provider to these compoonents?

I have several apps I want to use this UI-library with different theme colors.

I don't want to hardcode the colors into each component so I want all my components to be wrapped in a "global" ThemeProvider of some sort to supply the colors.

How can you accomplish this with bit.dev?

Do I really wrap every single component with a ThemeProvider like this:

<ThemeProvider theme={theme}>
  <Button {args}>
    {args.children}
  </Button>
<ThemeProvider>

That seems a little strange, and I want each app to be able to supply it's own Theme (not hard-code one into the ui-components library)

I also don't want to have to supply a theme to every single component I import in my library.

Ideally they will just pick up my already existing ThemeProvider w/ emotion-css, or worst case I have to add another Provider that supplies the theme to all my bit.dev components?

Would really appreciate some help on how to do this with bit.dev? I feel like I'm missing something simple.

0

There are 0 best solutions below