/storybook-7-stencil

Primary LanguageTypeScriptMIT LicenseMIT

Built With Stencil

Stencil + Storybook 7

This is an example repo of using Storybook 7 HTML with stencil web components.

Getting Started

# Install Dependencies
pnpm install

# Start stencil compiler in watch mode
pnpm build --watch

# In a separate terminal, start storybook
pnpm storybook

How it works

My custom stencil components are imported and registered in the preview.js file. This is the only place where I have to import my components as it injects the web-components into Storybook's i-frame. After that, I can use them in any story.

// .storybook/preview.js
import { defineCustomElements } from '../dist/loader';

defineCustomElements();