mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-04 10:41:06 +08:00
6.4 KiB
6.4 KiB
import type { Meta, StoryObj } from '@storybook/angular';
import { Button } from './button.component';
import { action } from 'storybook/actions';
const meta: Meta<Button> = {
component: Button,
};
export default meta;
type Story = StoryObj<Button>;
export const Text: Story = {
render: () => ({
props: {
label: 'Button',
onClick: action('clicked'),
},
template: `<storybook-button [label]="label" (onClick)="onClick($event)"></storybook-button>`,
}),
};
import { action } from 'storybook/actions';
import { Button } from './Button';
export default {
component: Button,
};
export const Text = {
render: () => <Button label="Hello" onClick={action('clicked')} />,
};
import type { Meta, StoryObj } from '@storybook/react';
import { action } from 'storybook/actions';
import { Button } from './Button';
const meta = {
component: Button,
} satisfies Meta<typeof Button>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Basic: Story = {
render: () => <Button label="Hello" onClick={action('clicked')} />,
};
import type { Meta, StoryObj } from '@storybook/react';
import { action } from 'storybook/actions';
import { Button } from './Button';
const meta: Meta<typeof Button> = {
component: Button,
};
export default meta;
type Story = StoryObj<typeof Button>;
export const Basic: Story = {
render: () => <Button label="Hello" onClick={action('clicked')} />,
};
import { action } from 'storybook/actions';
import { Button } from './Button';
export default {
component: Button,
};
export const Text = {
render: () => <Button label="Hello" onClick={action('clicked')} />,
};
import type { Meta, StoryObj } from 'storybook-solidjs';
import { action } from 'storybook/actions';
import { Button } from './Button';
const meta = {
component: Button,
} satisfies Meta<typeof Button>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Basic: Story = {
render: () => <Button label="Hello" onClick={action('clicked')} />,
};
import type { Meta, StoryObj } from 'storybook-solidjs';
import { action } from 'storybook/actions';
import { Button } from './Button';
const meta: Meta<typeof Button> = {
component: Button,
};
export default meta;
type Story = StoryObj<typeof Button>;
export const Basic: Story = {
render: () => <Button label="Hello" onClick={action('clicked')} />,
};
import { action } from 'storybook/actions';
import Button from './Button.svelte';
export default {
component: Button,
};
export const Text = {
render: () => ({
Component: Button,
props: {
label: 'Hello',
},
on: {
click: action('clicked'),
},
}),
};
import type { Meta, StoryObj } from '@storybook/svelte';
import { action } from 'storybook/actions';
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 = {
render: (args) => ({
Component: Button,
props: args,
}),
args: {
primary: true,
label: 'Button',
},
};
import type { Meta, StoryObj } from '@storybook/svelte';
import { action } from 'storybook/actions';
import Button from './Button.svelte';
const meta: Meta<typeof Button> = {
component: Button,
};
export default meta;
type Story = StoryObj<typeof meta>;
export const Text: Story = {
render: () => ({
Component: Button,
props: {
label: 'Hello',
},
on: {
click: action('clicked'),
},
}),
};
import Button from './Button.vue';
import { action } from 'storybook/actions';
export default {
component: Button,
};
export const Text = {
render: () => ({
components: { Button },
setup() {
return {
onClick: action('clicked'),
};
},
template: '<Button label="Hello" @click="onClick" />',
}),
};
import type { Meta, StoryObj } from '@storybook/vue3';
import Button from './Button.vue';
import { action } from 'storybook/actions';
const meta = {
component: Button,
} satisfies Meta<typeof Button>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Text: Story = {
render: () => ({
components: { Button },
setup() {
return {
onClick: action('clicked'),
};
},
template: '<Button label="Hello" @click="onClick" />',
}),
};
import type { Meta, StoryObj } from '@storybook/vue3';
import Button from './Button.vue';
import { action } from 'storybook/actions';
const meta: Meta<typeof Button> = {
component: Button,
};
export default meta;
type Story = StoryObj<typeof Button>;
export const Text: Story = {
render: () => ({
components: { Button },
setup() {
return {
onClick: action('clicked'),
};
},
template: '<Button label="Hello" @click="onClick" />',
}),
};
import { html } from 'lit';
import { action } from 'storybook/actions';
export default {
component: 'custom-button',
};
export const Text = {
render: () => html`<custom-button label="Hello" @click=${action('clicked')}></custom-button>`,
};
import type { Meta, StoryObj } from '@storybook/web-components';
import { action } from 'storybook/actions';
import { html } from 'lit';
const meta: Meta = {
component: 'custom-button',
};
export default meta;
type Story = StoryObj;
export const Text: Story = {
render: () => html`<custom-button label="Hello" @click=${action('clicked')}></custom-button>`,
};