storybook/docs/snippets/svelte/your-component-with-decorator.js.mdx
2022-07-07 19:15:02 +01:00

35 lines
688 B
Plaintext

```js
// YourComponent.stories.js
import YourComponent from './YourComponent.svelte';
import MarginDecorator from './MarginDecorator.svelte';
export default {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/7.0/svelte/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'YourComponent',
component: YourComponent,
decorators: [() => MarginDecorator]
};
// Your templates and stories here.
// Don't forget to use the component you're testing and not the MarginDecorator component
```
```html
<!-- MarginDecorator.svelte -->
<div>
<slot/>
</div>
<style>
div {
margin: 3em;
}
</style>
```