storybook/docs/snippets/vue/list-story-unchecked.ts-3.ts.mdx
2022-11-30 20:25:47 +00:00

43 lines
1.1 KiB
Plaintext

```ts
// List.stories.js
import List from './List.vue';
import ListItem from './ListItem.vue';
//👇 Imports a specific story from ListItem stories
import { Unchecked } from './ListItem.stories';
import type { Meta, StoryObj } from '@storybook/vue3';
const meta: Meta<typeof List> = {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/7.0/vue/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'List',
component: List,
};
export default meta;
type Story = StoryObj<typeof List>;
/*
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
* See https://storybook.js.org/docs/7.0/vue/api/csf
* to learn how to use render functions.
*/
export const OneItem: Story = {
render: (args) => ({
components: { List, ListItem },
setup() {
//👇 The args will now be passed down to the template
return { args };
},
template: '<List v-bind="args"><ListItem v-bind="args"/></List>',
}),
args: {
...Unchecked.args,
},
};
```