docs/_snippets/code-panel-in-meta-and-story.md
import type { Meta, StoryObj } from '@storybook/angular';
import { Button } from './button.component';
const meta: Meta<Button> = {
component: Button,
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
};
export default meta;
type Story = StoryObj<typeof Button>;
// ๐ This story will display the Code panel
export const Primary: Story = {
args: {
children: 'Button',
},
};
export const Secondary: Story = {
args: {
children: 'Button',
variant: 'secondary',
},
parameters: {
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
},
};
import preview from '../.storybook/preview';
import { Button } from './button.component';
const meta = preview.meta({
component: Button,
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
});
// ๐ This story will display the Code panel
export const Primary = meta.story({
args: {
children: 'Button',
},
});
export const Secondary = meta.story({
args: {
children: 'Button',
variant: 'secondary',
},
parameters: {
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
},
});
import type { Meta, StoryObj } from '@storybook/react-vite';
import { Button } from './Button';
const meta = {
component: Button,
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
} satisfies Meta<typeof Button>;
export default meta;
type Story = StoryObj<typeof meta>;
// ๐ This story will display the Code panel
export const Primary: Story = {
args: {
children: 'Button',
},
};
export const Secondary: Story = {
args: {
children: 'Button',
variant: 'secondary',
},
parameters: {
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
},
};
import { Button } from './Button';
export default {
component: Button,
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
};
// ๐ This story will display the Code panel
export const Primary = {
args: {
children: 'Button',
},
};
export const Secondary = {
args: {
children: 'Button',
variant: 'secondary',
},
parameters: {
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
},
};
<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';
import Button from './Button.svelte';
const { Story } = defineMeta({
component: Button,
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
});
</script>
<Story
name="Primary"
args={{
children: 'Button',
}}
/>
<Story
name="Secondary"
args={{
children: 'Button',
variant: 'secondary',
}}
parameters={{
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
}}
/>
// Replace your-framework with svelte-vite or sveltekit
import type { Meta, StoryObj } from '@storybook/your-framework';
import Button from './Button.svelte';
const meta = {
component: Button,
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
} satisfies Meta<typeof Button>;
export default meta;
type Story = StoryObj<typeof meta>;
// ๐ This story will display the Code panel
export const Primary: Story = {
args: {
children: 'Button',
},
};
export const Secondary: Story = {
args: {
children: 'Button',
variant: 'secondary',
},
parameters: {
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
},
};
<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';
import Button from './Button.svelte';
const { Story } = defineMeta({
component: Button,
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
});
</script>
<Story
name="Primary"
args={{
children: 'Button',
}}
/>
<Story
name="Secondary"
args={{
children: 'Button',
variant: 'secondary',
}}
parameters={{
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
}}
/>
import Button from './Button.svelte';
export default {
component: Button,
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
};
// ๐ This story will display the Code panel
export const Primary = {
args: {
children: 'Button',
},
};
export const Secondary = {
args: {
children: 'Button',
variant: 'secondary',
},
parameters: {
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
},
};
import type { Meta, StoryObj } from '@storybook/vue3-vite';
import Button from './Button.vue';
const meta = {
component: Button,
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
} satisfies Meta<typeof Button>;
export default meta;
type Story = StoryObj<typeof meta>;
// ๐ This story will display the Code panel
export const Primary: Story = {
args: {
children: 'Button',
},
};
export const Secondary: Story = {
args: {
children: 'Button',
variant: 'secondary',
},
parameters: {
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
},
};
import Button from './Button.vue';
export default {
component: Button,
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
};
// ๐ This story will display the Code panel
export const Primary = {
args: {
children: 'Button',
},
};
export const Secondary = {
args: {
children: 'Button',
variant: 'secondary',
},
parameters: {
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
},
};
import preview from '../.storybook/preview';
import Button from './Button.vue';
const meta = preview.meta({
component: Button,
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
});
// ๐ This story will display the Code panel
export const Primary = meta.story({
args: {
children: 'Button',
},
});
export const Secondary = meta.story({
args: {
children: 'Button',
variant: 'secondary',
},
parameters: {
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
},
});
import preview from '../.storybook/preview';
import Button from './Button.vue';
const meta = preview.meta({
component: Button,
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
});
// ๐ This story will display the Code panel
export const Primary = meta.story({
args: {
children: 'Button',
},
});
export const Secondary = meta.story({
args: {
children: 'Button',
variant: 'secondary',
},
parameters: {
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
},
});
import type { Meta, StoryObj } from '@storybook/web-components-vite';
const meta: Meta = {
component: 'demo-button',
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
};
export default meta;
type Story = StoryObj;
// ๐ This story will display the Code panel
export const Primary: Story = {
args: {
children: 'Button',
},
};
export const Secondary: Story = {
args: {
children: 'Button',
variant: 'secondary',
},
parameters: {
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
},
};
export default {
component: 'demo-button',
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
};
// ๐ This story will display the Code panel
export const Primary = {
args: {
children: 'Button',
},
};
export const Secondary = {
args: {
children: 'Button',
variant: 'secondary',
},
parameters: {
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
},
};
import preview from '../.storybook/preview';
const meta = preview.meta({
component: 'demo-button',
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
});
// ๐ This story will display the Code panel
export const Primary = meta.story({
args: {
children: 'Button',
},
});
export const Secondary = meta.story({
args: {
children: 'Button',
variant: 'secondary',
},
parameters: {
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
},
});
import preview from '../.storybook/preview';
const meta = preview.meta({
component: 'demo-button',
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
});
// ๐ This story will display the Code panel
export const Primary = meta.story({
args: {
children: 'Button',
},
});
export const Secondary = meta.story({
args: {
children: 'Button',
variant: 'secondary',
},
parameters: {
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
},
});
import preview from '../.storybook/preview';
import { Button } from './Button';
const meta = preview.meta({
component: Button,
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
});
// ๐ This story will display the Code panel
export const Primary = meta.story({
args: {
children: 'Button',
},
});
export const Secondary = meta.story({
args: {
children: 'Button',
variant: 'secondary',
},
parameters: {
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
},
});
import preview from '../.storybook/preview';
import { Button } from './Button';
const meta = preview.meta({
component: Button,
parameters: {
docs: {
// ๐ Enable Code panel for all stories in this file
codePanel: true,
},
},
});
// ๐ This story will display the Code panel
export const Primary = meta.story({
args: {
children: 'Button',
},
});
export const Secondary = meta.story({
args: {
children: 'Button',
variant: 'secondary',
},
parameters: {
docs: {
// ๐ Disable Code panel for this specific story
codePanel: false,
},
},
});