storybook/docs/snippets/react/my-component-story-configure-viewports.js.mdx
2021-05-06 21:05:56 +01:00

27 lines
561 B
Plaintext

```js
// MyComponent.stories.js | MyComponent.stories.ts
import React from 'react';
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
export default {
title: 'Stories',
parameters: {
//👇 The viewports object from the Essentials addon
viewport: {
//👇 The viewports you want to use
viewports: INITIAL_VIEWPORTS,
//👇 Your own default viewport
defaultViewport: 'iphone6'
},
},
};
export const MyStory = () => <div />;
MyStory.parameters = {
viewport: {
defaultViewport: 'iphonex'
},
};
```