Back to Storybook

Button Story Baseline

docs/_snippets/button-story-baseline.md

10.3.62.8 KB
Original Source
ts
import type { Meta, StoryObj } from '@storybook/angular';

import { Button } from './button.component';

const meta: Meta<Button> = {
  component: Button,
};

export default meta;
type Story = StoryObj<Button>;

//๐Ÿ‘‡ Throws a type error if the args don't match the component props
export const Primary: Story = {
  args: {
    primary: true,
  },
};
ts
import preview from '../.storybook/preview';

import { Button } from './button.component';

const meta = preview.meta({
  component: Button,
});

//๐Ÿ‘‡ Throws a type error if the args don't match the component props
export const Primary = meta.story({
  args: {
    primary: true,
  },
});
ts
// Replace your-framework with the framework you are using, e.g. react-vite, nextjs, vue3-vite, etc.
import type { Meta, StoryObj } from '@storybook/your-framework';

import { Button } from './Button';

const meta = {
  component: Button,
} satisfies Meta<typeof Button>;

export default meta;
type Story = StoryObj<typeof meta>;

//๐Ÿ‘‡ Throws a type error if the args don't match the component props
export const Primary: Story = {
  args: {
    primary: true,
  },
};
ts
import type { Meta, StoryObj } from '@storybook/web-components-vite';

const meta: Meta = {
  component: 'demo-button',
};

export default meta;
type Story = StoryObj;

export const Primary: Story = {
  args: {
    primary: true,
  },
};
ts
import preview from '../.storybook/preview';

const meta = preview.meta({
  component: 'demo-button',
});

//๐Ÿ‘‡ Throws a type error if the args don't match the component props
export const Primary = meta.story({
  args: {
    primary: true,
  },
});
ts
import preview from '../.storybook/preview';

import { Button } from './Button';

const meta = preview.meta({
  component: Button,
});

//๐Ÿ‘‡ Throws a type error if the args don't match the component props
export const Primary = meta.story({
  args: {
    primary: true,
  },
});
ts
import preview from '../.storybook/preview';

import Button from './Button.vue';

const meta = preview.meta({
  component: Button,
});

//๐Ÿ‘‡ Throws a type error if the args don't match the component props
export const Primary = meta.story({
  args: {
    primary: true,
  },
});