storybook-vue-iframe
Forked by
https://github.com/bmartel/storybook-vue-iframe https://github.com/hharnisc/storybook-vue-iframe
Quickstart
Install the addon
npm i --save-dev storybook-vue-iframe
Register the plugin
// in .storybook/addons.jsimport "@storybook/addon-actions/register";// register the Iframe addonimport "storybook-vue-iframe/register";
Link a Iframe design to your story
With React
import React from "react";import storiesOf from "@storybook/react";import IFrame from "storybook-vue-iframe"; ;
With Vue
import Vue from "vue";import storiesOf from "@storybook/vue";import IFrame from "storybook-vue-iframe/vue"; ;
Embed a different design on each story
import React from "react";import storiesOf from "@storybook/react";import IFrame from "storybook-vue-iframe"; ;
Or use the decorator to put the same design on each story
import React from "react";import storiesOf from "@storybook/react";import IframeDecorator from "storybook-vue-iframe";import App from "./components/App"; ;
Show Iframe design in right panel
If you find that the Iframe panel at the bottom is not big enough to fit your designs, it is possible to move the panel to the right of the window instead, where it is possible to give it more space. This requires the @storybook/addons-options addon. Note however that it is only possible to do this for all stories at once, and will move all addon panels to the right. A simple setup is shown here.
Install the addon
npm install --save-dev @storybook/addon-options
Register the options addon in your addons.js
// in .storybook/addons.jsimport "@storybook/addon-actions/register";import "storybook-vue-iframe/register";// register the options addonimport "@storybook/addon-options/register";
Import and use the setOptions
function in your config.js
file
// in .storybook/config.jsimport * as storybook from "@storybook/react";// import the options functionimport setOptions from "@storybook/addon-options"; // set option to show panel in right side; storybook;