Skip to content

Latest commit

 

History

History
55 lines (36 loc) · 1.25 KB

File metadata and controls

55 lines (36 loc) · 1.25 KB

React Storybook Info Addon

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

React Storybook Screenshot

Usage

Install the following npm module:

npm i --save-dev react-storybook-addon-add-stories-group
import { configure,setAddon } from '@kadira/storybook';
import addStoriesGroup from 'react-storybook-addon-add-stories-group'

setAddon(addStoriesGroup)

function loadStories() {
  require('../src/components/stories/MyComp');
  // require as many stories as you need.
}

configure(loadStories, module);

Then create your stories with the .addWithInfo API.

import { action , storiesOf} from '@kadira/storybook';
import MyComp from '../MyComp';

const stories = [
  {
    name:"with text" ,
    props: {text:"super error props", resetErrorMessage: action('clicked!') }
  },
  {
    name:"with very long text",
    props: {text:"super error this is a reaaaaaalllly long error, probably more than one line of text, even if you have a huge monitor, text text", resetErrorMessage: action('clicked!') }
  }
]

storiesOf('MyComp', module)
  .addStoriesGroup(MyComp, stories)

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