Go to file
Nils Norman Haukås 278c8cafec add nogithub badge 2024-01-22 19:18:17 +01:00
.storybook migrate to storybook v3 2017-06-13 15:28:11 +03:00
example migrate to storybook v3 2017-06-13 15:28:11 +03:00
src Support 5.x by replacing call to .onStory() with .on(STORY_CHANGED, ... ) 2019-06-27 09:42:49 +02:00
.babelrc Initial commit 2017-01-14 18:40:12 +03:00
.gitignore Initial commit 2017-01-14 18:40:12 +03:00
.npmignore Initial commit 2017-01-14 18:40:12 +03:00
README.md add nogithub badge 2024-01-22 19:18:17 +01:00
index.js migrate to storybook v3 2017-06-13 15:28:11 +03:00
package-lock.json Support 5.x by replacing call to .onStory() with .on(STORY_CHANGED, ... ) 2019-06-27 09:42:49 +02:00
package.json Support 5.x by replacing call to .onStory() with .on(STORY_CHANGED, ... ) 2019-06-27 09:42:49 +02:00
register.js Support 5.x by replacing call to .onStory() with .on(STORY_CHANGED, ... ) 2019-06-27 09:42:49 +02:00

README.md

npm version Please don't upload to GitHub

Static Markup addon for React Storybook

Displays a panel with an "html version" of a story, as suggested in this thread.

Live demo

Installation

Install the package:

npm i -D react-storybook-addon-static-markup

Then set the addon in your .storybook/config.js:

import { configure, setAddon } from '@storybook/react'

import staticMarkup from 'react-storybook-addon-static-markup'

setAddon(staticMarkup)

configure(() => {
  // ...
}, module)

...and register it in your .storybook/addons.js:

import 'react-storybook-addon-static-markup/register';

Usage

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

import { ShowStaticMarkup } from '../src'

storiesOf('Usage examples', module)
  .add(
    'with HOC',
    () => (
      <ShowStaticMarkup>
        <button className="foo bar baz">
          hello!
        </button>
      </ShowStaticMarkup>
    )
  )
  .addWithStaticMarkup(
    'with a "shortcut" method',
    () => (
      <div className="foo">
        hello
        <button className="btn primary">
          world!
        </button>
      </div>
    )
  )