mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 15:31:57 +08:00
9.4 KiB
9.4 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: {
primary: true,
label: '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) => {
const btn = document.createElement('button');
btn.innerText = args.label;
const mode = args.primary ? 'storybook-button--primary' : 'storybook-button--secondary';
btn.className = ['storybook-button', 'storybook-button--medium', mode].join(' ');
return btn;
},
args: {
primary: true,
label: 'Button',
},
};
import type { Meta, StoryObj } from '@storybook/html';
type ButtonArgs = {
primary: boolean;
label: string;
};
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) => {
const btn = document.createElement('button');
btn.innerText = args.label;
const mode = args.primary ? 'storybook-button--primary' : 'storybook-button--secondary';
btn.className = ['storybook-button', 'storybook-button--medium', mode].join(' ');
return btn;
},
args: {
primary: true,
label: 'Button',
},
};
/** @jsx h */
import { h } from 'preact';
import { Button } from './Button';
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) => <Button {...args} />,
args: {
primary: true,
label: 'Button',
},
};
import { Button } from './Button';
export default {
component: Button,
};
export const Primary = {
args: {
label: 'Button',
primary: true,
},
};
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: {
primary: true,
label: 'Button',
},
};
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: {
primary: true,
label: 'Button',
},
};
import { Button } from './Button';
export default {
component: Button,
};
export const Primary = {
args: {
label: 'Button',
primary: true,
},
};
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: {
primary: true,
label: 'Button',
},
};
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: {
primary: true,
label: 'Button',
},
};
<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';
import Button from './Button.svelte';
const { Story } = defineMeta({
component: Button,
});
</script>
<Story
name="Primary"
args={{
primary: true,
label: 'Button'
}}
/>
import Button from './Button.svelte';
export default {
component: Button,
};
export const Primary = {
args: {
primary: true,
label: 'Button',
},
};
<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';
import Button from './Button.svelte';
const { Story } = defineMeta({
component: Button,
});
</script>
<Story
name="Primary"
args={{
primary: true,
label: 'Button'
}}
/>
import type { Meta, StoryObj } from '@storybook/svelte';
import Button from './Button.svelte';
const meta = {
component: Button,
} satisfies Meta<typeof Button>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Primary: Story = {
args: {
primary: true,
label: 'Button',
},
};
<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';
import Button from './Button.svelte';
const { Story } = defineMeta({
component: Button,
});
</script>
<Story
name="Primary"
args={{
primary: true,
label: 'Button'
}}
/>
import type { Meta, StoryObj } from '@storybook/svelte';
import Button from './Button.svelte';
const meta: Meta<typeof Button> = {
component: Button,
};
export default meta;
type Story = StoryObj<typeof meta>;
export const Primary: Story = {
args: {
primary: true,
label: 'Button',
},
};
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: {
primary: true,
label: 'Button',
},
};
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: {
primary: true,
label: 'Button',
},
};
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: {
primary: true,
label: 'Button',
},
};
export default {
component: 'demo-button',
};
export const Primary = {
args: {
primary: true,
label: 'Button',
},
};
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: {
primary: true,
label: 'Button',
},
};