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

39 lines
887 B
Plaintext

```ts
// Button.stories.ts
import Button from './Button.vue';
import type { Meta, StoryObj } from '@storybook/vue3';
const meta: Meta<typeof Button> = {
/* 👇 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: 'Button',
component: Button,
};
export default meta;
type Story = StoryObj<typeof Button>;
/*
*👇 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 Primary: Story = {
render: (args) => ({
components: { Button },
setup() {
return { args };
},
template: '<Button v-bind="args" />',
}),
args: {
primary: true,
label: 'Button',
},
};
```