How to install storybook
Install storybook
npx storybook@latest init
install a11y tools
npm install --save-dev @storybook/addon-ally
Update .storybook/main.js
const config = {
stories: ['../src/components/**/*.stories.@(js|jsx)'],
staticDirs: ['../public'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-a11y',
],
framework: {
name: '@storybook/react-vite',
options: {},
},
};
export default config;
Start storybook
npm run storybook
References:
- https://storybook.js.org/tutorials/intro-to-storybook/react/en/simple-component/