@storybook-addon-options: per-story hiding panel, hides it for every story.
See original GitHub issueBug or support request summary
HI,
What we are trying to do, is to hide the knobs/actions panel per story. For example, on our welcomes page, we don’t need it. So we used the options-addon to hide it for this “component”. And it works, BUT it also hides the panel for the rest of the stories.
What we want is to be able to hide the panel for one story and let it re-appear once we switch stories. We know we can add the options again to the existing story, making it so that it shows up again, but I think that shouldn’t be the only solution, no?
Steps to reproduce
- Install the @storybook/addon-options
- add the { options: { showPanel: false } } to a story of your choice
- launch storybook and see if the panel is gone.
- Now, switch stories. Result: the panel is hidden for every story. Expected result: the panel should be hidden on 1 story, and shown for the others.
Please specify which version of Storybook and optionally any affected addons that you’re running
"@storybook/addon-actions": "^5.1.8",
"@storybook/addon-info": "^5.1.8",
"@storybook/addon-knobs": "^5.1.8",
"@storybook/addon-links": "^5.1.8",
"@storybook/addon-options": "^5.1.8",
"@storybook/addon-storyshots": "^5.1.8",
"@storybook/addons": "^5.1.8",
"@storybook/react": "^5.1.8",
"babel-plugin-require-context-hook": "^1.0.0",
"identity-obj-proxy": "^3.0.0",
"node-sass": "^4.12.0",
"prop-types": "^15.7.2",
"react-chromatic": "^0.8.4",
"react-content-loader": "^4.2.1",
"react-number-format": "^4.0.7",
"react-popover": "^0.5.10",
"sass-loader": "^7.1.0",
"styled-components": "^4.2.0"
Affected platforms
- Versie 75.0.3770.100 (Officiële build) (64-bits)
Screenshots / Screencast / Code Snippets (Optional)
This is the code used to create the story that hides the panel. And it works. But hides the panel for the rest of the stories also.
import React, { Fragment } from 'react';
import { storiesOf } from '@storybook/react';
const Welcome = () => {
return (
<Fragment>
<h1>Welcome</h1>
</Fragment>
);
};
storiesOf('Welcome', module).add('Getting started', () => <Welcome />, { options: { showPanel: false } });
End bug report support request - delete the rest below
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:24 (4 by maintainers)
Top Results From Across the Web
Hide addon per story in Storybook - Stack Overflow
If you want to hide the addons panel for all stories, write options: { showPanel: false } in the parameters variable in /.storybook/preview....
Read more >Features and behavior - Storybook
panelPosition, String/Object, Where to show the addon panel ; enableShortcuts, Boolean, Enable/disable shortcuts ; showToolbar, Boolean, Show/hide tool bar ; theme ...
Read more >Hide Addons panel for some stories in Storybook
To hide the panel for single story, set following parameters in Story: export default { title: 'Some title', parameters: { options: ...
Read more >@storybook/addon-options - npm
Start using @storybook/addon-options in your project by running `npm i ... display panel that shows a list of stories * @type {Boolean} ...
Read more >Args and addons - Storybook for React Apps
If you don't see the addon panel when running Storybook, you can type A , which is a shortcut to show/hide the addons...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This workaround is not working for me in
5.3.19
or6.0.10
. I tried this:I have
showPanel
set to true in.storybook/manager.js
In my documentation story, I am disabling it:
I have cleared all caches and site data in my browser.
When I first load a story that should have the panel shown, I see the panel. When I navigate to Getting Started where the panel is hidden, the panel disappears. However, when I navigate to any other story from there on out, the panel is always hidden.
Be awesome if it takes it one step further If a story doesn’t contain the settings/properties of a registered addon, it won’t show its panel/tab.