kibana/packages/kbn-storybook
Spencer 827e91c447
move and unify postcss config into @kbn/optimizer (#73633)
Co-authored-by: spalger <spalger@users.noreply.github.com>
2020-07-30 11:16:49 -07:00
..
lib move and unify postcss config into @kbn/optimizer (#73633) 2020-07-30 11:16:49 -07:00
storybook_config move and unify postcss config into @kbn/optimizer (#73633) 2020-07-30 11:16:49 -07:00
index.js apply prettier styles 2020-05-22 09:08:58 +02:00
package.json [kbn-storybook] Update Storybook to 5.3.19 (#73320) 2020-07-29 10:00:53 -04:00
README.md
yarn.lock

Kibana Storybook

This package provides ability to add Storybook to any Kibana plugin.

Setup Instructions

  1. Add storybook.js launcher file to your plugin. For example, create a file at src/plugins/<plugin>/scripts/storybook.js, with the following contents:

    import { join } from 'path';
    
    // eslint-disable-next-line
    require('@kbn/storybook').runStorybookCli({
      name: '<plugin>',
      storyGlobs: [join(__dirname, '..', 'public', 'components', '**', '*.examples.tsx')],
    });
    
  2. Add your plugin alias to src/dev/storybook/aliases.ts config.

  3. Create sample Storybook stories. For example, in your plugin create create a file at src/plugins/<plugin>/public/components/hello_world/__examples__/hello_world.examples.tsx with the following contents:

    import * as React from 'react';
    import { storiesOf } from '@storybook/react';
    
    storiesOf('Hello world', module).add('default', () => <div>Hello world!</div>);
    
  4. Launch Storybook with yarn storybook <plugin>.