question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create official Chakra UI Storybook addon

See original GitHub issue

The goal of this issue is to create an official Storybook preset addon for Chakra UI. Offering an official preset means that users need only install the preset to quickly get up and running with Chakra inside Storybook.

Tasks

  • Automatically decorate stories with ChakraProvider
  • Enable customization of ChakraProvider
    • Custom theme
    • resetCSS, portalZIndex, etc. props
  • Handle overriding Storybook emotion package conflicts? (see https://github.com/storybookjs/storybook/issues/13114 and #2527 for more context)
  • Dogfood the preset package for our own internal Storybook setup (the ultimate test!)

Possible stretch goals

  • Add a color mode toggle button to the UI Toolbar to allow users to quickly switch color mode of the current story

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:38
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

22reactions
with-heartcommented, Mar 2, 2021

I’d like to tackle this sometime this week. Going to reopen.

9reactions
TimKolbergercommented, Jan 4, 2022

We just released @chakra-ui/storybook-addon:

Use the official Storybook Addon for Chakra UI to configure Storybook to automatically wrap your stories with the <ChakraProvider /> and add a color mode toggle.

Installation

yarn add -D @chakra-ui/storybook-addon
yarn add @chakra-ui/icons

or

npm i -D @chakra-ui/storybook-addon
npm i @chakra-ui/icons

Usage

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

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

You can specify global parameters for the addon in .storybook/preview.js. These options are the same as the props to ChakraProvider (without children).

// .storybook/preview.js

const theme = require('../path/to/your/theme')

export const parameters = {
  chakra: {
    theme,
  },
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Chakra UI Addon | Storybook: Frontend workshop for UI ...
Use Chakra UI in your Storybook stories. This Plugin wraps each of your stories with ChakraProvider which can be configured using Storybook parameters....
Read more >
Chakra UI + Storybook
Use the official Storybook Addon for Chakra UI to configure Storybook to automatically wrap your stories with the <ChakraProvider /> and add a...
Read more >
Chakra UI with Storybook - CodeSandbox
CodeSandbox is an online editor tailored for web applications.
Read more >
Chakra UI is not loading when used with Storybook
I've set up Storybook and Chakra-UI using create-react-app following the decorator's documentation as mentioned here. Here's the link for the ...
Read more >
@chakra-ui/storybook-addon 4.0.15 on npm - Libraries.io
Chakra UI provides a set of accessible, reusable, and composable React components that make it super easy to create websites and apps.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found