@mihkeleidast/storybook-addon-source
v1.0.1
Published
Displays the source example of the current story
Downloads
20,082
Maintainers
Readme
@mihkeleidast/storybook-addon-source
Installation
First, install the package.
npm install --save-dev @mihkeleidast/storybook-addon-source
Then, register it as an addon in .storybook/main.js
.
// .storybook/main.ts
// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite)
import type { StorybookConfig } from '@storybook/your-framework';
const config: StorybookConfig = {
// ...rest of config
addons: [
'@storybook/addon-essentials'
'@mihkeleidast/storybook-addon-source', // 👈 register the addon here
],
};
export default config;
Then, add the decorator in .storybook/preview.js
.
// .storybook/preview.ts
import { Preview } from "@storybook/react";
import { withJsx } from '../dist/index.js'
const preview: Preview = {
decorators: [
withJsx, // 👈 add the decorator as the first one
// ... rest of decorators
],
};
export default preview;