Overview
Storybook-addon-mantine is an addon for Storybook that wraps Mantine components with a MantineProvider. It allows users to switch between themes and see how their components and pages will look.
Features
- Theme Switching: Users can easily switch between themes and see the impact on their components and pages.
- MantineProvider Wrapping: Mantine components are wrapped with the MantineProvider, providing a consistent theme throughout.
- Customization: Users can pass themes and MantineProvider props to customize the addon as needed.
Installation
To use the Storybook-addon-mantine:
- Install the addon in your project.
- Register the addon in your project’s
.storybook/main.jsfile. - Pass the theme(s) to the addon in your
.storybook/preview.jsfile.
Here are the specific steps:
- Install the addon: [command to install addon]
- Register the addon: Add the following code to your
.storybook/main.jsfile:// Register the addon addons: [ '@storybook/addon-mantine', ], - Pass the theme(s) to the addon: Add the following code to your
.storybook/preview.jsfile:// Pass the theme(s) to the addon export const decorators = [ withThemesProvider(themesList, mantineProviderProps), ];
Please note that themeName is an optional key you can provide to override the name shown in the Storybook panel. It’s also recommended to set withGlobalStyles to true if you use dark mode.
For more information about how to use the addon, please refer to the documentation at [addon documentation link].
Summary
Storybook-addon-mantine is a useful addon for Storybook that allows users to easily switch between themes and see how their Mantine components and pages will look. It provides a straightforward installation process and offers customization options such as passing themes and MantineProvider props. The addon is built upon the foundation laid by storybook-addon-material-ui.