Skip to content
This repository was archived by the owner on Mar 6, 2025. It is now read-only.

mihkeleidast/storybook-addon-source

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4473c61 Β· Mar 6, 2025

History

7 Commits
Apr 26, 2024
May 1, 2024
Apr 26, 2024
May 1, 2024
Apr 26, 2024
Apr 26, 2024
Apr 26, 2024
Apr 26, 2024
Mar 6, 2025
Apr 26, 2024
May 1, 2024
May 1, 2024
Apr 26, 2024
Apr 26, 2024
Apr 26, 2024
May 1, 2024
Apr 26, 2024

Repository files navigation

@mihkeleidast/storybook-addon-source

Note: this addon is deprecated. Storybook's own docs addon supports this now natively: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#added-source-code-panel-to-docs.

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;