storybook/docs/snippets/react/component-story-static-asset-with-import.mdx.mdx
2021-10-12 21:52:15 +01:00

22 lines
496 B
Plaintext

```md
<!-- MyComponent.stories.mdx -->
import { Meta, Story } from '@storybook/addon-docs';
import { MyComponent } from './MyComponent';
import imageFile from './static/image.png';
<Meta title="img" component={MyComponent}/>
export const image = {
src: imageFile,
alt: 'my image',
};
<!-- Render functions are a framework specific feature to allow you control on how the component renders -->
<Story
name="withAnImage"
render={() => <img src={image.src} alt={image.alt} />} />
```