Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I selectively show tabs in panel? #9853

Closed
dvnrsn opened this issue Feb 14, 2020 · 5 comments
Closed

How can I selectively show tabs in panel? #9853

dvnrsn opened this issue Feb 14, 2020 · 5 comments

Comments

@dvnrsn
Copy link

dvnrsn commented Feb 14, 2020

Is your feature request related to a problem? Please describe.
Is there a way to selectively show addons like actions, knobs

I want to hide globally and then pick certain stories that should show them

image

Docs has a good way of disabling per story but I'd like a way of enabling per story.

I feel like this would exist but I'm not understanding. I tried excluding from addons in main.js and then using the .story = {decorator: [knobs]} kind of syntax

@shilman
Copy link
Member

shilman commented Feb 14, 2020

@dvnrsn you can use showPanel to completely show or hide that panel based on the story https://storybook.js.org/docs/configurations/options-parameter/#per-story-options

@dvnrsn
Copy link
Author

dvnrsn commented Feb 14, 2020

This doesn't quite address the job to be done seeing as I generally want to show only a few of the addons. It is good to know about because I would use it. However, when I apply the following code on an individual story, it seems to apply to every story, hiding the panel globally which is not desired.

export default {
  title: 'mycomp',
  component: mycomp,
  parameters: {
    options: {
      showPanel: false,
    }
  }
}

@dvnrsn
Copy link
Author

dvnrsn commented Feb 14, 2020

Just found this blog https://medium.com/storybookjs/declarative-storybook-configuration-49912f77b78 which seems to articulate the future of storybook config. I realize I joined this party right when there were some major changes happening so I might need to adjust my config to this standard. To solve my problem here, perhaps manager.js is necessary as indicated in the link provided by shilman above.

@shilman
Copy link
Member

shilman commented Feb 14, 2020

@dvnrsn I think it's all or nothing. You can hide the entire panel or show it. You can't selectively hide tabs currently.

@dvnrsn
Copy link
Author

dvnrsn commented Feb 14, 2020

Ah, ok.

What I learned is that one must include the addon in main.js addons AND sometimes include it in the story itself (eg decorators: [withKnobs]). It would be cool to have a way to only include tabs when desired, but this is not the current intention of addons.

@dvnrsn dvnrsn closed this as completed Feb 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants