1 | # Storybook Viewport Addon
|
2 |
|
3 | Storybook 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 |
|
11 | Viewport 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
|
14 | npm i -D @storybook/addon-viewport
|
15 | ```
|
16 |
|
17 | Then, add following content to [`.storybook/main.js`](https://storybook.js.org/docs/react/configure/overview#configure-your-storybook-project):
|
18 |
|
19 | ```js
|
20 | export default {
|
21 | addons: ['@storybook/addon-viewport'],
|
22 | };
|
23 | ```
|
24 |
|
25 | You should now be able to see the viewport addon icon in the the toolbar at the top of the screen.
|
26 |
|
27 | ## Usage
|
28 |
|
29 | The usage is documented in the [documentation](https://storybook.js.org/docs/react/essentials/viewport).
|