Back to Storybook

Button Story Rename Story

docs/_snippets/button-story-rename-story.md

10.3.68.5 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>;

export const Primary: Story = {
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
};
ts
import preview from '../.storybook/preview';

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

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

export const Primary = meta.story({
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
});
js
import { createButton } from './Button';

export default {
  render: (args) => createButton(args),
};

export const Primary = {
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
};
ts
import type { Meta, StoryObj } from '@storybook/html';

import { createButton, ButtonArgs } from './Button';

const meta: Meta<ButtonArgs> = {
  render: (args) => createButton(args),
};

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

export const Primary: Story = {
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
};
js
import { Button } from './Button';

export default {
  component: Button,
};

export const Primary = {
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
};
ts
// 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 = {
  component: Button,
} satisfies Meta<typeof Button>;

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

export const Primary: Story = {
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
};
js
import { Button } from './Button';

export default {
  component: Button,
};

export const Primary = {
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
};
tsx
import type { Meta, StoryObj } from 'storybook-solidjs-vite';

import { Button } from './Button';

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

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

export const Primary: Story = {
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
};
svelte
<script module>
  import { defineMeta } from '@storybook/addon-svelte-csf';

  import Button from './Button.svelte';

  const { Story } = defineMeta({
    component: Button,
  });
</script>

<Story
  name="I am the primary"
  exportName="Primary"
/>
svelte
<script module>
  import { defineMeta } from '@storybook/addon-svelte-csf';

  import Button from './Button.svelte';

  const { Story } = defineMeta({
    component: Button,
  });
</script>

<Story
  name="I am the primary"
  exportName="Primary"
/>
js
import Button from './Button.svelte';

export default {
  component: Button,
};

export const Primary = {
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
};
ts
// Replace your-framework with the framework you are using, e.g. sveltekit or svelte-vite
import type { Meta, StoryObj } from '@storybook/your-framework';

import Button from './Button.svelte';

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

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

export const Primary: Story = {
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
};
js
import Button from './Button.vue';

export default {
  component: Button,
};

export const Primary = {
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
};
ts
import type { Meta, StoryObj } from '@storybook/vue3-vite';

import Button from './Button.vue';

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

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

export const Primary: Story = {
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
};
js
export default {
  component: 'demo-button',
};

export const Primary = {
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    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 = {
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
};
js
import preview from '../.storybook/preview';

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

export const Primary = meta.story({
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
});
ts
import preview from '../.storybook/preview';

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

export const Primary = meta.story({
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
});
ts
import preview from '../.storybook/preview';

import Button from './Button.vue';

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

export const Primary = meta.story({
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
});
<!-- JS snippets still needed while providing both CSF 3 & Next -->
js
import preview from '../.storybook/preview';

import Button from './Button.vue';

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

export const Primary = meta.story({
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
});
ts
import preview from '../.storybook/preview';

import { Button } from './Button';

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

export const Primary = meta.story({
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
});
<!-- JS snippets still needed while providing both CSF 3 & Next -->
js
import preview from '../.storybook/preview';

import { Button } from './Button';

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

export const Primary = meta.story({
  // ๐Ÿ‘‡ Rename this story
  name: 'I am the primary',
  args: {
    label: 'Button',
    primary: true,
  },
});