Storybook: Deep Linking: put path of component>story in the URL

Created on 22 Jan 2017  路  9Comments  路  Source: storybookjs/storybook

Forgive me if I am missing the obvious.

I see that deep linking has been available since #6 but I can't seem to find any documentation on how it is actually achieved.

I can see the generated query string but unless it is re-used in its entirety then the app just falls back to the first story. I would have thought ?selectedKind=Button would at least bring me to the Button section.

is there any way to currently achieve deep linking within react-storybook?

feature request

Most helpful comment

This is merged and will be released w/ version 3.0

All 9 comments

@dptoot Maybe this is what you are looking for? https://github.com/storybooks/storybook-addon-links

Thanks Marc, but what I am looking for is external links into react-storybook. My hope would be that http://localhost:9001/?selectedKind=Button would bring me to the initial story of button component but in actuality it will render the first story of the first component in the list.

I am trying to utilize react-storybook as a styleguide and being able to give user links that direct them directly to particular components and stories would be very helpful

Sorry, didn't understand your question correctly.

Seems you need to provide at least the selectedStory parameter along with selectedKind to have it to work.
Is it a problem for your use case?

If so maybe we can submit a PR for this?
I think this test can be changed to return the first story of a kind if the selectedStory is missing or if the specified story is not found.

@arunoda any advice with this?

@marc-rutkowski

Thanks! That actually does work for my use case as I have a standard naming convention for the initial story for each component story set. I would posit that that can't be relied on for everyuser though. I lucked out. Humbly, and without looking too much into the source code, I would say the expectation would be that only selectedKind be required to link into the storybook and the default selectedStory would fall back back to the first story in the story array, if not supplied. I would be happy to help out on a PR if @arunoda thinks this is the direction he would like to take things.

This seems like a reasonable feature. See also https://github.com/storybooks/react-storybook/issues/614.

See linked PR (https://github.com/storybooks/storybook-ui/pull/78)

This is merged and will be released w/ version 3.0

This seems to have regressed with version 5.0.0. Are there any plans to fix this?

Thanks for the bug @NicoleGrondinAlayacare -- tracking it here: https://github.com/storybooks/storybook/issues/5925

Was this page helpful?
0 / 5 - 0 ratings