JSPM

  • Created
  • Published
  • Downloads 17923
  • Score
    100M100P100Q134572F
  • License MIT

Provides a link to the story's source in the toolbar

Package Exports

  • storybook-source-link
  • storybook-source-link/dist/cjs/index.js
  • storybook-source-link/dist/esm/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (storybook-source-link) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Storybook Addon Source Link

Provides a link to the story's source in the toolbar. Initialized with this template. There you'll find specifics on development and release inside the README.md

Usage

Inside each story, include a parameters for your stories source code.

in any .stories.js file:

export default {
  title: 'Example',
  component: Button,
  parameters: {
    sourceLink: '<link to source>'
  }
};

If the parameter is set, clicking the icon button will take you to the source link.

Screen Shot 2022-03-23 at 1 15 50 PM

If an inactive source link is clicked, a tool-top will remind the user of this usage.

Alternatively, you may set a default link in the .storybook/preview.js file like so:

export const parameters = {
  defaultSourceLink: '<link to source>'
}