```ts filename="YourComponent.stories.ts" renderer="angular" language="ts" import { componentWrapperDecorator } from '@storybook/angular'; import type { Meta } from '@storybook/angular'; import { YourComponent } from './your.component'; const meta: Meta = { component: YourComponent, decorators: [componentWrapperDecorator((story) => `
${story}
`)], }; export default meta; ``` ```js filename="YourComponent.stories.js|jsx" renderer="react" language="js" import { YourComponent } from './YourComponent'; export default { component: YourComponent, decorators: [ (Story) => (
{/* 👇 Decorators in Storybook also accept a function. Replace with Story() to enable it */}
), ], }; ``` ```ts filename="YourComponent.stories.ts|tsx" renderer="react" language="ts-4-9" import type { Meta } from '@storybook/react'; import { YourComponent } from './YourComponent'; const meta = { component: YourComponent, decorators: [ (Story) => (
{/* 👇 Decorators in Storybook also accept a function. Replace with Story() to enable it */}
), ], } satisfies Meta; export default meta; ``` ```ts filename="YourComponent.stories.ts|tsx" renderer="react" language="ts" import type { Meta } from '@storybook/react'; import { YourComponent } from './YourComponent'; const meta: Meta = { component: YourComponent, decorators: [ (Story) => (
{/* 👇 Decorators in Storybook also accept a function. Replace with Story() to enable it */}
), ], }; export default meta; ``` ```js filename="YourComponent.stories.js|jsx" renderer="solid" language="js" import { YourComponent } from './YourComponent'; export default { component: YourComponent, decorators: [ (Story) => (
), ], }; ``` ```js filename="YourComponent.stories.js|jsx" renderer="solid" language="js" tabTitle="story-function-js" import { YourComponent } from './YourComponent'; // Replacing the element with a Story function is also a good way of writing decorators. // Useful to prevent the full remount of the component's story. export default { component: YourComponent, decorators: [(Story) =>
{Story()}
], }; ``` ```tsx filename="YourComponent.stories.ts|tsx" renderer="solid" language="ts" tabTitle="story-function-ts" import type { Meta } from 'storybook-solidjs'; import { YourComponent } from './YourComponent'; // Replacing the element with a Story function is also a good way of writing decorators. // Useful to prevent the full remount of the component's story. const meta: Meta = { component: YourComponent, decorators: [(Story) =>
{Story()}
], }; export default meta; ``` ```tsx filename="YourComponent.stories.ts|tsx" renderer="solid" language="ts-4-9" import type { Meta } from 'storybook-solidjs'; import { YourComponent } from './YourComponent'; const meta = { component: YourComponent, decorators: [ (Story) => (
), ], } satisfies Meta; export default meta; ``` ```tsx filename="YourComponent.stories.ts|tsx" renderer="solid" language="ts" import type { Meta } from 'storybook-solidjs'; import { YourComponent } from './YourComponent'; const meta: Meta = { component: YourComponent, decorators: [ (Story) => (
), ], }; export default meta; ``` ```js filename="YourComponent.stories.js" renderer="svelte" language="js" import YourComponent from './YourComponent.svelte'; import MarginDecorator from './MarginDecorator.svelte'; export default { component: YourComponent, decorators: [() => MarginDecorator], }; ``` ```html renderer="svelte" language="ts" tabTitle="native-format" {/* YourComponent.stories.svelte */} ``` ```ts filename="YourComponent.stories.ts" renderer="svelte" language="ts-4-9" import type { Meta } from '@storybook/svelte'; import YourComponent from './YourComponent.svelte'; import MarginDecorator from './MarginDecorator.svelte'; const meta = { component: Button, decorators: [() => MarginDecorator], } satisfies Meta; export default meta; ``` ```ts filename="YourComponent.stories.ts" renderer="svelte" language="ts" import type { Meta } from '@storybook/svelte'; import YourComponent from './YourComponent.svelte'; import MarginDecorator from './MarginDecorator.svelte'; const meta: Meta = { component: YourComponent, decorators: [() => MarginDecorator], }; export default meta; ``` ```js filename="YourComponent.stories.js" renderer="vue" language="js" import YourComponent from './YourComponent.vue'; export default { component: YourComponent, decorators: [() => ({ template: '
' })], }; ``` ```ts filename="YourComponent.stories.ts" renderer="vue" language="ts-4-9" import type { Meta } from '@storybook/vue3'; import YourComponent from './YourComponent.vue'; const meta = { component: YourComponent, decorators: [() => ({ template: '
' })], } satisfies Meta; export default meta; ``` ```ts filename="YourComponent.stories.ts" renderer="vue" language="ts" import type { Meta } from '@storybook/vue3'; import YourComponent from './YourComponent.vue'; const meta: Meta = { component: YourComponent, decorators: [() => ({ template: '
' })], }; export default meta; ``` ```js filename="YourComponent.stories.js" renderer="web-components" language="js" import { html } from 'lit'; export default { component: 'demo-your-component', decorators: [(story) => html`
${story()}
`], }; ``` ```ts filename="YourComponent.stories.ts" renderer="web-components" language="ts" import { html } from 'lit'; import type { Meta } from '@storybook/web-components'; const meta: Meta = { component: 'demo-your-component', decorators: [(story) => html`
${story()}
`], }; export default meta; ```