New
You're viewing older docs for version 6.3. View latest docs

Addon knowledge base

Once you understand the basics of writing addons, there are a variety of common enhancements to make your addon better. This page details additional information about addon creation. Use it as a quick reference guide when creating your own addons.

Disable the addon panel

It’s possible to disable the addon panel for a particular story.

To make that possible, you need to pass the paramKey element when you register the panel:

Then when adding a story, you can pass a disabled parameter.

Style your addon

Storybook uses Emotion for styling. Alongside with a theme which you can customize!

We recommend you also to use Emotion to style your addon’s UI components. That allows you to use the active Storybook theme to deliver a seamless developer experience. If you don’t want to use Emotion, you can use inline styles or another css-in-js lib. You can receive the theme as a prop by using the withTheme hoc from Emotion. Read more about theming.

Storybook components

Addon authors can develop their UIs using any React library. But we recommend using Storybook’s own UI components in @storybook/components to build addons faster. When you use Storybook components you get:

  • Battle-tested off-the-shelf components
  • Storybook native look and feel
  • Built-in support for Storybook theming

Use the components listed below with your next addon.

ComponentSourceStory
Action BarSee component implementationSee component story
Addon PanelSee component implementationN/A
BadgeSee component implementationSee component story
ButtonSee component implementationSee component story
FormSee component implementationSee component story
LoaderSee component implementationSee component story
PlaceHolderSee component implementationSee component story
Scroll AreaSee component implementationSee component story
SpaceSee component implementationSee component story
Syntax HighlighterSee component implementationSee component story
TabsSee component implementationSee component story
ToolBarSee component implementationN/A
ToolTipSee component implementationSee component story
ZoomSee component implementationSee component story

Complementing the components, also included is a set of UI primitives. Use the content listed below as reference for styling your addon.

ComponentSourceStory
Color Pallette (see note below)See implementationSee story
IconSee implementationSee story
TypographySee implementationSee story
The color palette implemented by @storybook/components is a high-level abstraction of the @storybook/theming package.

Build system

When you're developing your addon as a package, you can’t use npm link to add it to your project. List your addon as a local dependency into your package.json:

Loading...
Run either yarn or npm install to install the addon.

Hot module replacement

While developing your addon you can configure HMR (hot module replacement) to reflect the changes made.

Standalone Storybook addons

If you're developing a standalone addon, add a new script to package.json with the following:

Loading...

Local Storybook addons

If you're developing a local Storybook addon that is built on top of an existing Storybook installation HMR (hot module replacement) is available out of the box.

If you don't see the changes being reflected, add the flag --no-manager-cache to the storybook script and restart Storybook.

Was this page helpful?

Markdown accepted ([link text](url), _italic_, **bold**, etc). Your anonymous feedback will be posted publicly on GitHub.

✍️ Edit on GitHub – PRs welcome!
Storybook
Join the community
6,565 developers and counting
WhyWhy StorybookComponent-driven UI
DocsGuidesTutorialsChangelogTelemetryStatus
CommunityAddonsGet involvedBlog
ShowcaseExploreProjectsComponent glossary
Open source software
Storybook

Maintained by
Chromatic
Special thanks to Netlify and CircleCI