storybook/docs/snippets/svelte/component-story-static-asset-with-import.ts-4-9.mdx
2023-12-04 21:23:56 +00:00

29 lines
494 B
Plaintext

```ts
// MyComponent.stories.ts
import type { Meta, StoryObj } from '@storybook/svelte';
import MyComponent from './MyComponent.svelte';
import imageFile from './static/image.png';
const meta = {
component: MyComponent,
} satisfies Meta<typeof MyComponent>;
export default meta;
type Story = StoryObj<typeof meta>;
const image = {
src: imageFile,
alt: 'my image',
};
export const WithAnImage: Story = {
render: () => ({
Component: MyComponent,
props: image,
}),
};
```