storybook/docs/snippets/svelte/my-component-with-env-variables.mdx.mdx
2021-10-11 19:53:39 +01:00

23 lines
615 B
Plaintext

```md
<!-- MyComponent.stories.mdx -->
import { Meta, Story, Canvas } from '@storybook/addon-docs';
import MyComponent from './MyComponent.svelte';
<Meta title="A MDX story using environment variables inside a .env file" component={MyComponent}/>
<!-- Render functions are a framework specific feature to allow you control on how the component renders -->
<Canvas>
<Story
name="A MDX story using environment variables inside a .env file"
args={{
propertyA: process.env.STORYBOOK_DATA_KEY,
}}
render={(args) => ({
Component: MyComponent,
props: args,
})} />
</Canvas>
```