Usage with Storybook
Create sharable theme object
Create a separate file that will store your theme object – you will need to use it both for your application and Storybook:
MantineProvider with Storybook
To add MantineProvider (and other providers) to your Storybook setup create preview.tsx
file in your Storybook configuration folder (usually it is called .storybook
):
Color scheme toggle
To setup color scheme toggle in Storybook use storybook-dark-mode addon:
Then integrate it in decorator that was created in previous step:
Note that you will need to use ColorSchemeProvider
only if you have components that use useMantineColorScheme
.
If you do not use this hook in your application then it is safe to omit ColorSchemeProvider
from your Storybook setup: