storybook/docs/snippets/vue/button-story-using-args.3.ts-4-9.mdx
2023-11-27 20:57:51 -07:00

62 lines
1.2 KiB
Plaintext

```ts
// Button.stories.ts
import type { Meta, StoryObj } from '@storybook/vue3';
import Button from './Button.vue';
const meta = {
component: Button,
} satisfies Meta<typeof Button>;
export default meta;
type Story = StoryObj<typeof meta>;
/*
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
* See https://storybook.js.org/docs/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: {
background: '#ff0',
label: 'Button',
},
};
export const Secondary: Story = {
render: (args) => ({
components: { Button },
setup() {
return { args };
},
template: '<Button v-bind="args" />',
}),
args: {
...Primary.args,
label: '😄👍😍💯',
},
};
export const Tertiary: Story = {
render: (args) => ({
components: { Button },
setup() {
return { args };
},
template: '<Button v-bind="args" />',
}),
args: {
...Primary.args,
label: '📚📕📈🤓',
},
};
```