Setup Mantine in Storybook
Note that this guide covers only Storybook 7.0+ integration. If you are using older version of Storybook, it will not work for you.
Add Storybook to your application
If you already have Storybook in your application, you can skip this step.
Follow Storybook getting started guide to add Storybook to your application:
Configure addons
Note that @storybook/addon-styling-webpack
is required only if you are
not using Vite. If you are using Vite, do not install @storybook/addon-styling-webpack
and do not add it to the addons section in main.ts
file.
Install Storybook addons:
Add addons to .storybook/main.ts
:
Theme object
To shared theme object between your application and Storybook, create
src/theme.ts
(or any other path in your application) file with your theme override:
Then you will be able to use the same theme both in your application and Storybook:
Storybook preview
If .storybook/preview.tsx
file does not exist, create it and add
the following content:
All set! Start Storybook: