react-storybook-addon-sections

0.0.12 • Public • Published

React Storybook Sections Addon

A React Storybook addon to show additional information for your stories.

DEMO

Usage

Install the following npm module:

npm i -D react-storybook-addon-sections

Then set the addon in the place you configure storybook like this:

import React from 'react';
import { configure, setAddon } from '@storybook/react';
import sectionsAddon from 'react-storybook-addon-sections';

setAddon(sectionsAddon);

configure(function () {
  ...
}, module);

Then create your stories with the .addWithSections API.

import React from 'react';
import Button from './Button';
import { storiesOf } from '@storybook/react';

storiesOf('Button')
    .addWithSections('Global sections', () => (
        <Button>Simple</Button>
    ))
    .addWithSections('Single section', () => (
        <Button>Simple</Button>
    ), ReactView);

Have a look at this example stories to learn more about the addWithSections API.

The FAQ

Components lose their names on static build

Component names also get minified with other javascript code when building for production. When creating components, set the displayName static property to show the correct component name on static builds.

Versions

Current Tags

Version History

Package Sidebar

Install

npm i react-storybook-addon-sections

Weekly Downloads

2

Version

0.0.12

License

MIT

Last publish

Collaborators

  • nutgaard