New
Storybook for full-stack developersAutomate with Chromatic
Star75,299
Back to integrations
Add your integration
Categories
  • ⭐️ Popular
  • 🧩 Essentials
  • 🛠 Code
  • ⚡️ Data & state
  • ✅ Test
  • 💅 Style
  • 🎨 Design
  • ⚙️ Appearance
  • 🗄 Organize
How to install addons Create an addon
@snek-at/storybook-addon-chakra-ui
Use Chakra UI in your Storybook stories.
npm install @snek-at/storybook-addon-chakra-ui
Last updated 3 months ago
2.1k
Downloads per week
Readme View on GitHub

@chakra-ui/storybook-addon

Use Chakra UI in your Storybook stories.

Wraps each of your stories with ChakraProvider which can be configured using Storybook parameters.

Demo

https://user-images.githubusercontent.com/52858351/164954327-5e395475-f9e5-4569-83e7-fcf3394d9567.mov

Installation

yarn

yarn add -D @snek-at/storybook-addon-chakra-ui

npm

npm i -D @snek-at/storybook-addon-chakra-ui

Add the addon to your configuration in .storybook/main.js:

module.exports = {
  addons: ['@snek-at/storybook-addon-chakra-ui']
}

Configuring ChakraProvider

If you need to customize the props passed to ChakraProvider for your stories (to use a custom theme, for example), you'll need to create custom Storybook parameters.

To set global parameters for this addon, add a chakra object to the parameters export in .storybook/preview.js:

import myTheme from '../theme'
export const parameters = {chakra: {theme: myTheme}}

The chakra parameters take the same shape as the props for ChakraProvider. See the ChakraProvider props table to see the list of possible parameters.

Overriding ChakraProvider configuration for individual components or stories

Storybook allows you to define parameters at multiple levels: global, component, and story. We recommend setting default parameters at the global level, and overriding them at the component or story when necessary. See the Storybook Parameters documentation for more information.

Join the community
5,867 developers and counting
WhyWhy StorybookComponent-driven UI
Open source software
Storybook

Maintained by
Chromatic
Special thanks to Netlify and CircleCI