mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-09 00:19:13 +08:00
13 KiB
13 KiB
import type { Meta, StoryObj } from '@storybook/angular';
import { Button } from './button.component';
const meta: Meta<Button> = {
component: Button,
};
export default meta;
type Story = StoryObj<Button>;
export const Primary: Story = {
args: {
label: 'Button',
backgroundColor: '#ff0',
},
};
export const Secondary: Story = {
args: {
...Primary.args,
label: '😄👍😍💯',
},
};
export const Tertiary: Story = {
args: {
...Primary.args,
label: '📚📕📈🤓',
},
};
import { createButton } from './Button';
export default {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/configure/#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
};
/*
*👇 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 = {
render: (args) => createButton(args),
args: {
primary: true,
label: 'Button',
},
};
export const Secondary = {
render: (args) => createButton(args),
args: {
...Primary.args,
label: '😄👍😍💯',
},
};
export const Tertiary = {
render: (args) => createButton(args),
args: {
...Primary.args,
label: '📚📕📈🤓',
},
};
import type { Meta, StoryObj } from '@storybook/html';
import { createButton, ButtonArgs } from './Button';
const meta: Meta<ButtonArgs> = {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/configure/#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
};
export default meta;
type Story = StoryObj<ButtonArgs>;
/*
*👇 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) => createButton(args),
args: {
primary: true,
label: 'Button',
},
};
export const Secondary: Story = {
render: (args) => createButton(args),
args: {
...Primary.args,
label: '😄👍😍💯',
},
};
export const Tertiary: Story = {
render: (args) => createButton(args),
args: {
...Primary.args,
label: '📚📕📈🤓',
},
};
import { Button } from './Button';
export default {
component: Button,
};
export const Primary = {
args: {
backgroundColor: '#ff0',
label: 'Button',
},
};
export const Secondary = {
args: {
...Primary.args,
label: '😄👍😍💯',
},
};
export const Tertiary = {
args: {
...Primary.args,
label: '📚📕📈🤓',
},
};
import type { Meta, StoryObj } from '@storybook/react';
import { Button } from './Button';
const meta = {
component: Button,
} satisfies Meta<typeof Button>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Primary: Story = {
args: {
backgroundColor: '#ff0',
label: 'Button',
},
};
export const Secondary: Story = {
args: {
...Primary.args,
label: '😄👍😍💯',
},
};
export const Tertiary: Story = {
args: {
...Primary.args,
label: '📚📕📈🤓',
},
};
import type { Meta, StoryObj } from '@storybook/react';
import { Button } from './Button';
const meta: Meta<typeof Button> = {
component: Button,
};
export default meta;
type Story = StoryObj<typeof Button>;
export const Primary: Story = {
args: {
backgroundColor: '#ff0',
label: 'Button',
},
};
export const Secondary: Story = {
args: {
...Primary.args,
label: '😄👍😍💯',
},
};
export const Tertiary: Story = {
args: {
...Primary.args,
label: '📚📕📈🤓',
},
};
import { Button } from './Button';
export default {
component: Button,
};
export const Primary = {
args: {
backgroundColor: '#ff0',
label: 'Button',
},
};
export const Secondary = {
args: {
...Primary.args,
label: '😄👍😍💯',
},
};
export const Tertiary = {
args: {
...Primary.args,
label: '📚📕📈🤓',
},
};
import type { Meta, StoryObj } from 'storybook-solidjs';
import { Button } from './Button';
const meta = {
component: Button,
} satisfies Meta<typeof Button>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Primary: Story = {
args: {
backgroundColor: '#ff0',
label: 'Button',
},
};
export const Secondary: Story = {
args: {
...Primary.args,
label: '😄👍😍💯',
},
};
export const Tertiary: Story = {
args: {
...Primary.args,
label: '📚📕📈🤓',
},
};
import type { Meta, StoryObj } from 'storybook-solidjs';
import { Button } from './Button';
const meta: Meta<typeof Button> = {
component: Button,
};
export default meta;
type Story = StoryObj<typeof Button>;
export const Primary: Story = {
args: {
backgroundColor: '#ff0',
label: 'Button',
},
};
export const Secondary: Story = {
args: {
...Primary.args,
label: '😄👍😍💯',
},
};
export const Tertiary: Story = {
args: {
...Primary.args,
label: '📚📕📈🤓',
},
};
import Button from './Button.svelte';
export default {
component: Button,
};
export const Primary = {
args: {
backgroundColor: '#ff0',
label: 'Button',
},
};
export const Secondary = {
args: {
...Primary.args,
label: '😄👍😍💯',
},
};
export const Tertiary = {
args: {
...Primary.args,
label: '📚📕📈🤓',
},
};
{/* Button.stories.svelte */}
<script>
import { Meta, Template, Story } from '@storybook/addon-svelte-csf';
import Button from './Button.svelte';
</script>
<Meta title="Button" component={Button} argTypes={{ label: { control: 'text' }, primary: { control:
'boolean' }, }} />
{/* 👇 We create a “template” of how args map to rendering */}
<template let:args>
<button {...args} />
</template>
{/* 👇 Each story then reuses that template */}
<Story name="Primary" args={{ background: '#ff0', label: 'Button' }} /> <Story name="Secondary"
args={{ background: '#ff0', label: '😄👍😍💯' }} /> <Story name="Tertiary" args={{ background:
'#ff0', label: '📚📕📈🤓' }} />
import type { Meta, StoryObj } from '@storybook/svelte';
import Button from './Button.svelte';
//👇This default export determines where your story goes in the story list
const meta = {
component: Button,
} satisfies Meta<typeof Button>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Primary: Story = {
args: {
backgroundColor: '#ff0',
label: 'Button',
},
};
export const Secondary: Story = {
args: {
...Primary.args,
label: '😄👍😍💯',
},
};
export const Tertiary: Story = {
args: {
...Primary.args,
label: '📚📕📈🤓',
},
};
import type { Meta, StoryObj } from '@storybook/svelte';
import Button from './Button.svelte';
//👇This default export determines where your story goes in the story list
const meta: Meta<typeof Button> = {
component: Button,
};
export default meta;
type Story = StoryObj<typeof meta>;
export const Primary: Story = {
args: {
backgroundColor: '#ff0',
label: 'Button',
},
};
export const Secondary: Story = {
args: {
...Primary.args,
label: '😄👍😍💯',
},
};
export const Tertiary: Story = {
args: {
...Primary.args,
label: '📚📕📈🤓',
},
};
import Button from './Button.vue';
export default {
component: Button,
};
/*
*👇 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 = {
render: (args) => ({
components: { Button },
setup() {
return { args };
},
template: '<Button v-bind="args" />',
}),
args: {
backgroundColor: '#ff0',
label: 'Button',
},
};
export const Secondary = {
args: {
...Primary.args,
label: '😄👍😍💯',
},
render: (args) => ({
components: { Button },
setup() {
return { args };
},
template: '<Button v-bind="args" />',
}),
};
export const Tertiary = {
args: {
...Primary.args,
label: '📚📕📈🤓',
},
render: (args) => ({
components: { Button },
setup() {
return { args };
},
template: '<Button v-bind="args" />',
}),
};
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: '📚📕📈🤓',
},
};
import type { Meta, StoryObj } from '@storybook/vue3';
import Button from './Button.vue';
const meta: Meta<typeof 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/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: '📚📕📈🤓',
},
};
export default {
component: 'demo-button',
};
export const Primary = {
args: {
background: '#ff0',
label: 'Button',
},
};
export const Secondary = {
args: {
...Primary.args,
label: '😄👍😍💯',
},
};
export const Tertiary = {
args: {
...Primary.args,
label: '📚📕📈🤓',
},
};
import type { Meta, StoryObj } from '@storybook/web-components';
const meta: Meta = {
component: 'demo-button',
};
export default meta;
type Story = StoryObj;
export const Primary: Story = {
args: {
background: '#ff0',
label: 'Button',
},
};
export const Secondary: Story = {
args: {
...Primary.args,
label: '😄👍😍💯',
},
};
export const Tertiary: Story = {
args: {
...Primary.args,
label: '📚📕📈🤓',
},
};