storybook/docs/_snippets/addon-backgrounds-define-default.md
Kyle Gach 838b611b3b Further updates
- Polish and details
- Make Viewport match structure and style of Backgrounds
2024-08-14 21:13:40 -06:00

156 lines
3.3 KiB
Markdown

```ts filename="Button.stories.ts" renderer="angular" language="ts"
import type { Meta, StoryObj } from '@storybook/angular';
import { Button } from './button.component';
const meta: Meta<Button> = {
component: Button,
parameters: {
backgrounds: {
// 👇 Set default background value for all component stories
default: 'Gray',
},
},
};
export default meta;
type Story = StoryObj<Button>;
export const OnDark: Story = {
parameters: {
backgrounds: {
// 👇 Override default background value for this story
default: 'Dark',
},
},
};
```
```js filename="Button.stories.js|jsx" renderer="common" language="js"
import { Button } from './Button';
export default {
component: Button,
parameters: {
backgrounds: {
// 👇 Set default background value for all component stories
default: 'Gray',
},
},
};
export const OnDark = {
parameters: {
backgrounds: {
// 👇 Override default background value for this story
default: 'Dark',
},
},
};
```
```ts filename="Button.stories.ts|tsx" renderer="common" language="ts-4-9"
// Replace your-framework with the name of your framework
import type { Meta, StoryObj } from '@storybook/your-framework';
import { Button } from './Button';
const meta = {
component: Button,
parameters: {
backgrounds: {
// 👇 Set default background value for all component stories
default: 'Gray',
},
},
} satisfies Meta<typeof Button>;
export default meta;
type Story = StoryObj<typeof meta>;
export const OnDark: Story = {
parameters: {
backgrounds: {
// 👇 Override default background value for this story
default: 'Dark',
},
},
};
```
```ts filename="Button.stories.ts|tsx" renderer="common" language="ts"
// Replace your-framework with the name of your framework
import type { Meta, StoryObj } from '@storybook/your-framework';
import { Button } from './Button';
const meta: Meta<typeof Button> = {
component: Button,
parameters: {
backgrounds: {
// 👇 Set default background value for all component stories
default: 'Gray',
},
},
};
export default meta;
type Story = StoryObj<typeof Button>;
export const OnDark: Story = {
parameters: {
backgrounds: {
// 👇 Override default background value for this story
default: 'Dark',
},
},
};
```
```js filename="Button.stories.js" renderer="web-components" language="js"
export default {
component: 'demo-button',
parameters: {
backgrounds: {
// 👇 Set default background value for all component stories
default: 'Gray',
},
},
};
export const OnDark = {
parameters: {
backgrounds: {
// 👇 Override default background value for this story
default: 'Dark',
},
},
};
```
```ts filename="Button.stories.ts" renderer="web-components" language="ts"
import type { Meta, StoryObj } from '@storybook/web-components';
const meta: Meta = {
component: 'demo-button',
parameters: {
backgrounds: {
// 👇 Set default background value for all component stories
default: 'Gray',
},
},
};
export default meta;
type Story = StoryObj;
export const OnDark: Story = {
parameters: {
backgrounds: {
// 👇 Override default background value for this story
default: 'Dark',
},
},
};
```