storybook-addon-external-links
TypeScript icon, indicating that this package has built-in type declarations

2.0.3 • Public • Published

Storybook Addon Source Link

npm npm

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

Usage

Inside each component, include a parameter for your components's source code.

*.stories.js

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

This can be done at the story level as well

*.stories.js

export const Primary = () => (
  <Button>Primary</Button>
);
Primary.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 global parameter to define a default link in the .storybook/preview.js file like so:

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

Precedence follows the rules of parameter inheritance

Dependents (1)

Package Sidebar

Install

npm i storybook-addon-external-links

Weekly Downloads

11

Version

2.0.3

License

MIT

Unpacked Size

24.1 kB

Total Files

25

Last publish

Collaborators

  • oleksandr_krupko