docs/_snippets/button-story-with-addon-example.md
import type { Meta, StoryObj } from '@storybook/angular';
import { Button } from './button.component';
const meta: Meta<Button> = {
/* ๐ The title prop is optional.
* See https://storybook.js.org/docs/configure/#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
component: Button,
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'this data is passed to the addon',
},
},
};
export default meta;
type Story = StoryObj<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 Basic: Story = {
render: () => ({
template: `<app-button>hello</<app-button>`,
}),
};
import preview from '../.storybook/preview';
import { Button } from './button.component';
const meta = preview.meta({
/* ๐ The title prop is optional.
* See https://storybook.js.org/docs/configure/#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
component: Button,
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'this data is passed to the addon',
},
},
});
/*
*๐ 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 Basic = meta.story({
render: () => ({
template: `<app-button>hello</<app-button>`,
}),
});
import * as React from 'react';
import { Button } 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',
component: Button,
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'This data is passed to the addon',
},
},
};
export const Basic = {
render: () => <Button>Hello</Button>,
};
import * as React from 'react';
// Replace your-framework with the framework you are using, e.g. react-vite, nextjs, nextjs-vite, etc.
import type { Meta, StoryObj } from '@storybook/your-framework';
import { Button } from './Button';
const meta = {
/* ๐ The title prop is optional.
* See https://storybook.js.org/docs/configure/#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
component: Button,
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'This data is passed to the addon',
},
},
} 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 Basic: Story = {
render: () => <Button>Hello</Button>,
};
import { Button } 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',
component: Button,
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'This data is passed to the addon',
},
},
};
export const Basic = {
render: () => <Button>Hello</Button>,
};
import type { Meta, StoryObj } from 'storybook-solidjs-vite';
import { Button } from './Button';
const meta = {
/* ๐ The title prop is optional.
* See https://storybook.js.org/docs/configure/#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
component: Button,
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'this data is passed to the addon',
},
},
} 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 Basic: Story = {
render: () => <Button>Hello</Button>,
};
<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';
import Button from './Button.svelte';
const { Story } = defineMeta({
/* ๐ The title prop is optional.
* See https://storybook.js.org/docs/configure/#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
component: Button,
parameters: {
myAddon: {
data: 'This data is passed to the addon',
},
},
});
</script>
<Story name="Basic"/>
import Button from './Button.svelte';
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',
component: Button,
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'this data is passed to the addon',
},
},
};
export const Basic = {};
<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';
import Button from './Button.svelte';
const { Story } = defineMeta({
/* ๐ The title prop is optional.
* See https://storybook.js.org/docs/configure/#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
component: Button,
parameters: {
myAddon: {
data: 'This data is passed to the addon',
},
},
});
</script>
<Story name="Basic"/>
// Replace your-framework with svelte-vite or sveltekit
import type { Meta, StoryObj } from '@storybook/your-framework';
import Button from './Button.svelte';
const meta = {
/* ๐ The title prop is optional.
* See https://storybook.js.org/docs/configure/#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
component: Button,
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'this data is passed to the addon',
},
},
} satisfies Meta<typeof Button>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Basic: Story = {};
import Button from './Button.vue';
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',
component: Button,
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'This data is passed to the addon',
},
},
};
export const Basic = {
render: () => ({
components: { Button },
template: '<Button label="Hello" />',
}),
};
import type { Meta, StoryObj } from '@storybook/vue3-vite';
import Button from './Button.vue';
const meta = {
/* ๐ The title prop is optional.
* See https://storybook.js.org/docs/configure/#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
component: Button,
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'This data is passed to the addon',
},
},
} 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 Basic: Story = {
render: () => ({
components: { Button },
template: '<Button label="Hello" />',
}),
};
import { html } from 'lit';
export default {
title: 'Button',
component: 'custom-button',
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'This data is passed to the addon',
},
},
};
/*
*๐ 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 Basic = {
render: () => html`<custom-button label="Hello"></custom-button>`,
};
import type { Meta, StoryObj } from '@storybook/web-components-vite';
import { html } from 'lit';
const meta: Meta = {
title: 'Button',
component: 'custom-button',
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'This data is passed to the addon',
},
},
};
export default meta;
type Story = StoryObj;
/*
*๐ 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 Basic: Story = {
render: () => html`<custom-button label="Hello"></custom-button>`,
};
import { html } from 'lit';
import preview from '../.storybook/preview';
const meta = preview.meta({
title: 'Button',
component: 'custom-button',
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'This data is passed to the addon',
},
},
});
/*
*๐ 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 Basic = meta.story({
render: () => html`<custom-button label="Hello"></custom-button>`,
});
import { html } from 'lit';
import preview from '../.storybook/preview';
const meta = preview.meta({
title: 'Button',
component: 'custom-button',
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'This data is passed to the addon',
},
},
});
/*
*๐ 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 Basic = meta.story({
render: () => html`<custom-button label="Hello"></custom-button>`,
});
import preview from '../.storybook/preview';
import Button from './Button.vue';
const meta = preview.meta({
/* ๐ The title prop is optional.
* See https://storybook.js.org/docs/configure/#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
component: Button,
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'This data is passed to the addon',
},
},
});
/*
*๐ 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 Basic = meta.story({
render: () => ({
components: { Button },
template: '<Button label="Hello" />',
}),
});
import preview from '../.storybook/preview';
import Button from './Button.vue';
const meta = preview.meta({
/* ๐ The title prop is optional.
* See https://storybook.js.org/docs/configure/#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
component: Button,
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'This data is passed to the addon',
},
},
});
/*
*๐ 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 Basic = meta.story({
render: () => ({
components: { Button },
template: '<Button label="Hello" />',
}),
});
import * as React from 'react';
import preview from '../.storybook/preview';
import { Button } from './Button';
const meta = preview.meta({
/* ๐ The title prop is optional.
* See https://storybook.js.org/docs/configure/#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
component: Button,
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'This data is passed to the addon',
},
},
});
/*
*๐ 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 Basic = meta.story({
render: () => <Button>Hello</Button>,
});
import * as React from 'react';
import preview from '../.storybook/preview';
import { Button } from './Button';
const meta = preview.meta({
/* ๐ The title prop is optional.
* See https://storybook.js.org/docs/configure/#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
component: Button,
//๐ Creates specific parameters for the story
parameters: {
myAddon: {
data: 'This data is passed to the addon',
},
},
});
export const Basic = meta.story({
render: () => <Button>Hello</Button>,
});