Skip to content

Configuration

After installing the packages, create the configuration files.

The minimum configuration for Astro-only stories:

export default {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
framework: {
name: '@storybook-astro/framework',
options: {},
},
};

To use framework components (React, Vue, Svelte, etc.), add integrations:

import { react, vue, svelte } from '@storybook-astro/framework/integrations';
export default {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
framework: {
name: '@storybook-astro/framework',
options: {
integrations: [
react({ include: ['**/react/**'] }),
vue(),
svelte(),
],
},
},
};

Sanitization is enabled by default. To disable it explicitly:

export default {
framework: {
name: '@storybook-astro/framework',
options: {
sanitization: { enabled: false },
},
},
};

See the Configuration Reference for all available options.

const preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};
export default preview;

If your project uses global CSS, a CSS utility framework (UnoCSS, Tailwind CSS), or custom fonts, see the Styling guide for how to make them available in Storybook.

"scripts": {
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
}
Terminal window
npm run storybook

Storybook will open at http://localhost:6006. You’re ready to start writing stories.