mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 06:51:46 +08:00
32 lines
682 B
Plaintext
32 lines
682 B
Plaintext
```ts
|
|
// MyComponent.stories.ts
|
|
|
|
import { html } from 'lit-html';
|
|
|
|
import type { Meta, StoryObj } from '@storybook/web-components';
|
|
|
|
import imageFile from './static/image.png';
|
|
|
|
const meta: Meta = {
|
|
title: 'img',
|
|
component: 'my-component',
|
|
};
|
|
|
|
const image = {
|
|
src: imageFile,
|
|
alt: 'my image',
|
|
};
|
|
|
|
export default meta;
|
|
type Story = StoryObj;
|
|
|
|
/*
|
|
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
|
|
* See https://storybook.js.org/docs/7.0/web-components/api/csf
|
|
* to learn how to use render functions.
|
|
*/
|
|
export const WithAnImage: Story = {
|
|
render: () => html`<img src="${image.src}" alt="${image.alt}" />`,
|
|
};
|
|
```
|