How to open the toolbar and focus an addon in Storybook from the currently open story

42 Views Asked by At

I'm currently setting up documentation and examples in Storybook. I have added an addon to show the developer the code of the story. And I want to add a link/button "click here to view the code". When the developer clicks on it to open the Toolbar/Addonsbar and focus on the adding for the Code preview.

I'm not finding a way to do it. Can someone give me a hand?

1

There are 1 best solutions below

0
Julien Andreu On

what is the addon you're using to show up the source code right now?

I'm personally using autodoc to have source code and it's working like a charm: enter image description here

You could also transform the source with this API: https://storybook.js.org/docs/api/doc-block-source#transform