Getting Started

Introduction

Nuxt Storybook is made of two packages, a Nuxt module and a Storybook framework.

Nuxt Storybook brings your Nuxt app into Storybook: stories render your components with the plugins, auto-imports, components and runtime config of your app. It is made of two packages, which do different jobs.

@storybook-vue/nuxt@nuxtjs/storybook
KindStorybook frameworkNuxt module
Configured in.storybook/main.ts and .storybook/preview.tsnuxt.config.ts
Used bystorybook dev, storybook build and nuxt devnuxt dev only
RequiredYesNo

The Storybook framework

@storybook-vue/nuxt is the Storybook framework for Nuxt. You set it as the framework of .storybook/main.ts, and it makes your stories Nuxt-aware:

The framework works on its own: storybook dev and storybook build only need it.

The Nuxt module

@nuxtjs/storybook is the Nuxt module that makes Storybook available through your Nuxt server. Add it to the modules of nuxt.config.ts to:

  • Serve Storybook from nuxt dev, on the same host and port as your app, under /_storybook/.
  • Open Storybook in a Nuxt DevTools tab.
  • Include .storybook/ in the TypeScript config Nuxt generates.

It has a few options, such as the route Storybook is served on. The module depends on the framework, and does nothing during nuxt build or storybook build.

Which one do I need?

  • Storybook with Nuxt: the framework. Setup installs it with Storybook.
  • Storybook in nuxt dev and the Nuxt DevTools: the module as well.
Your project imports @storybook-vue/nuxt in .storybook/ and in your stories, so install it next to @nuxtjs/storybook even when you use the module.