UNPKG

1.13 kBMarkdownView Raw
1# Storybook Viewport Addon
2
3Storybook Viewport Addon allows your stories to be displayed in different sizes and layouts in [Storybook](https://storybook.js.org). This helps build responsive components inside of Storybook.
4
5[Framework Support](https://storybook.js.org/docs/react/api/frameworks-feature-support)
6
7![Screenshot](https://raw.githubusercontent.com/storybookjs/storybook/next/code/addons/viewport/docs/viewport.png)
8
9## Installation
10
11Viewport is part of [essentials](https://storybook.js.org/docs/react/essentials/introduction) and so is installed in all new Storybooks by default. If you need to add it to your Storybook, you can run:
12
13```sh
14npm i -D @storybook/addon-viewport
15```
16
17Then, add following content to [`.storybook/main.js`](https://storybook.js.org/docs/react/configure/overview#configure-your-storybook-project):
18
19```js
20export default {
21 addons: ['@storybook/addon-viewport'],
22};
23```
24
25You should now be able to see the viewport addon icon in the the toolbar at the top of the screen.
26
27## Usage
28
29The usage is documented in the [documentation](https://storybook.js.org/docs/react/essentials/viewport).