kibana/packages/kbn-storybook
Brandon Kobel 57af8462e4
[7.x] Elastic License 2.0 (#90192)
* Updating everything except the license headers themselves

* Applying ESLint rules

* Manually replacing the stragglers
2021-02-03 18:39:13 -08:00
..
lib [7.x] Elastic License 2.0 (#90192) 2021-02-03 18:39:13 -08:00
index.ts [7.x] Elastic License 2.0 (#90192) 2021-02-03 18:39:13 -08:00
package.json [7.x] Elastic License 2.0 (#90192) 2021-02-03 18:39:13 -08:00
preset.js [7.x] Elastic License 2.0 (#90192) 2021-02-03 18:39:13 -08:00
README.md [7.x] Storybook 6 and config changes (#75357) (#78894) 2020-10-05 12:43:44 -05:00
tsconfig.json [7.x] Storybook 6 and config changes (#75357) (#78894) 2020-10-05 12:43:44 -05:00
typings.d.ts [7.x] Elastic License 2.0 (#90192) 2021-02-03 18:39:13 -08:00
webpack.config.ts [7.x] Elastic License 2.0 (#90192) 2021-02-03 18:39:13 -08:00

Kibana Storybook

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

Setup Instructions

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

    module.exports = require('@kbn/storybook').defaultConfig;
    
  • Add your plugin alias to src/dev/storybook/aliases.ts config.

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

    import { MyComponent } from './my_component';
    
    export default {
      component: MyComponent,
      title: 'Path/In/Side/Navigation/ToComponent',
    };
    
    export function Example() {
      return <MyComponent />;
    }
    
  • Launch Storybook with yarn storybook <plugin>, or build a static site with yarn storybook --site <plugin>.

Customizing configuration

The defaultConfig object provided by the @kbn/storybook package should be all you need to get running, but you can override this in your .storybook/main.js. Using Storybook's configuration options.