Open novellac opened 3 years ago
How to completely hide control for prop from Controls pane?
How can we hide a property from the controls page?
disabling a single row foo
from showing up in the table:
export default {
title: ...,
component: ...,
argTypes: {
foo: { table: { disable: true } }
},
}
cc @jonniebigodes
How to disable controls for a story in MDX?
For a component:
<Meta
title=...
component={...}
argTypes={{
foo: { table: { disable: true } }
}}
/>
For a story:
<Story
name=...
argTypes={{
foo: { table: { disable: true } }
}}
>
...
</Story>
Is it possible to do the opposite? I mean, I set the controls to hide by default and then enable what I want to see?
In MDX the ArgsTable block has an include prop that does what you want. But not for the other use case unfortunately @FilipMessa
An addition to this, is there a way to disable the controls, but still have them shown? I have a boolean I always want to be true in a curtain state and I want to show its supposed to be true when displaying this component.
@rayzoor12 it's an open issue #12693
is there a way to disable all controls for a story? (without having to disable one by one with table: {disable:true}). I want to have one interactive story (with controls) and the other stories just as read only use cases.
@chalovega-cs I think you can filter all of them like this: https://storybook.js.org/docs/react/essentials/controls#filtering-controls
Hi @shilman, How can I conditionally disable a control in Storybook based on the value of another argument?
@JokerDang unfortunately you can't
@shilman , I saw you created PR for similar this feature. https://github.com/storybookjs/storybook/pull/13890
so it work now ?
No the PR was closed without merging
Possible workaround: in preview.js
, filter out all the controls:
export const parameters = {
controls: {
exclude: /^.*?/
},
};
Describe the bug When I set the parameter for controls to disabled, the
Controls
tab disappears, but controls are still present on thedocsPage
.To Reproduce Steps to reproduce the behavior:
*.stories.js
file (maybe MDX too, but I have only verified this on*.stories.js
), set the export default as such:MyGreatComponent
Controls
tab is no longer visible.Docs
tab.Expected behavior When I disable controls for a component, I expect both the controls tab to disappear AND the controls column on the
docsPage
to disappear, as well.System: