JSPM

@storybook/addon-links

3.0.0-rc.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6080864
  • Score
    100M100P100Q212919F
  • License MIT

Story Links addon for storybook

Package Exports

  • @storybook/addon-links
  • @storybook/addon-links/register
  • @storybook/addon-links/register.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/addon-links) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Story Links Addon

Greenkeeper badge Build Status CodeFactor Known Vulnerabilities BCH compliance codecov Storybook Slack

The Storybook Links addon can be used to create links between stories in Storybook.

This addon works with Storybook for: React and React Native.

Getting Started

You can use this addon without installing it.

import { storiesOf } from '@storybook/react'
import { linkTo } from '@storybook/addon-links'

storiesOf('Button', module)
  .add('First', () => (
    <button onClick={linkTo('Button', 'Second')}>Go to "Second"</button>
  ))
  .add('Second', () => (
    <button onClick={linkTo('Button', 'First')}>Go to "First"</button>
  ));

Have a look at the linkTo function:

linkTo('Toggle', 'off')

With that, you can link an event in a component to any story in the Storybook.

  • First parameter is the the story kind name (what you named with storiesOf).
  • Second parameter is the story name (what you named with .add).

You can also pass a function instead for any of above parameter. That function accepts arguments emitted by the event and it should return a string.
Have a look at PR86 for more information.