storybook-vue-slots

Vue Slots support for Storybook
26,123
Install
npm install storybook-vue-slots
Latest Version:9.1.5
Vue:3
License:MIT
Last Updated:Sep 12, 2025
Links: npm
Maintainer: webkor

Vue

Vue Slots Addon

version Vue 3 Storybook 9

Enables to use Vue slots inside Storybook's CSF files.

Features

  • Vue 3 support
  • Generate code snippets for stories with slots
  • Control specific aspect of the slot via Storybook's controls
  • Wrap slot content with components

📦 Installation

pnpm add -D storybook-vue-slots

Add the storybook-vue-slots to your plugins in main.ts file:

// .storybook/main.ts
export default {
  // ...
  addons: [
    // ...
    "storybook-vue-slots",
  ],
} satisfies StorybookConfig;

Examples

Run:

npm run storybook

To run an example Storybook

Usage

Zero

By default, the addon will pass the [slotName] arg to the template, e.x. {{ args.default }}.

Basic

Add a description to the slot by passing a string to the slot definition:

// MyComponent.stories.ts

export default meta = {
  parameters: {
    slots: {
      default: `Default slot content`,
    },
  },
};

Standard

Use args.[slotName] inside the template to pass data from Storybook controls to the slot, or access other args.

// MyComponent.stories.ts

export default meta = {
  parameters: {
    slots: {
      default: {
        description: "Default slot",
        template: `<p>{{ args.default }}</p>`,
      },
      header: {
        description: "Header slot",
        template: `<p>{{ args.header }}</p>`,
      },
    },
  },
};

So, value of header arg control in Storybook table is being passed into the slot template, allowing control of an aspect of the slot.

Advanced

Adding components
// MyComponent.stories.ts

export default meta = {
  parameters: {
    slots: {
      default: {
        description: "Default slot",
        template: `<p>{{ args.default }}</p>`,
      },
      header: {
        description: "Header slot",
        components: { AppButton },
        template: `<AppButton>{{ args.header }}</AppButton>`,
      },
    },
  },
};

Todo

  • Slots fallback support

Contribute

💖 Funding

Donate with PayPal button

License

MIT License © 2025 Webkor

Note: This repository is a fork created and maintained by Webkor to provide updates and compatibility with newer Storybook versions. The original project is available at https://github.com/JoJk0/storybook-addon-vue-slots

Related Packages

storybook-addon-vue-slots

Vue Slots support for Storybook

491,750 22
storybook-tailwind-foundations

Storybook tailwind foundations from tailwind.config.js as stories

19,089 8
@chrishrb/storybook-addon-vue-manifest

Generate Storybook component manifests for Vue 3 projects using vue-component-me...

2,885
@storybook/preset-vue-webpack

Storybook for Vue: Develop Vue Component in isolation with Hot Reloading.

1,230,873 91,393
@storybook/vue3-webpack5

Storybook for Vue 3: Develop Vue 3 Components in isolation with Hot Reloading.

915,143 91,343

Version History

Version Released Vue License
9.1.5 ^3.3.4 MIT