addon-controls - Disabling controls for a story does not hide them on argsTable
See original GitHub issueDescribe the bug
When I set the controls
parameter to { disabled: true }
for a story, the “Control” column into <argsTable story="">
doesn’t disappear, even if I override argTypes
on story with control: { type: null }
.
Case 1: <Story parameters={{ controls: { disable: true } }}></Story>
argsTable
Control panel
Case 2: <Story argTypes={{ title: { control: { type: null } } }}></Story>
argsTable
Control panel
To Reproduce Steps to reproduce the behaviour:
- In a *.stories.mdx file:
import {
Meta,
Story,
Canvas,
ArgsTable,
} from '@storybook/addon-docs'
import html from './card.html'
<Meta
title="Components/Card"
parameters={{
viewMode: 'docs',
}}
args={{
title: '',
}}
argTypes={{
title: {
name: 'Titre',
description: 'Titre de l’article',
type: { name: 'string', required: true },
table: {
type: {
summary: 'string',
},
defaultValue: { summary: '' },
},
control: { type: 'text' },
}
}}
/>
export const PlaygroundTmpl = (args) => `
<div class="Card">
<h4 class="Card-title">${args.title}</h4>
</div>
`
# Card
<Canvas>
<Story
name="Card"
height="600px"
parameters={{
controls: { disable: true },
docs: { source: { code: html } },
viewMode: 'story',
}}
>
{PlaygroundTmpl.bind({})}
</Story>
</Canvas>
<ArgsTable story="Card" />
<Canvas>
<Story
name="Card 1"
height="600px"
parameters={{
controls: { disable: true },
docs: { source: { code: html } },
viewMode: 'story',
}}
argTypes={{
title: { control: { type: null } },
}}
>
{PlaygroundTmpl.bind({})}
</Story>
</Canvas>
<ArgsTable story="Card 1" />
- Serve Storybook.
- Navigate to MyGreatComponent
- Click on the Canvas tab.
- See that the Controls tab is no visible.
- Click on the Docs tab.
- See that the “Control” column and the reload button are still visible.
Expected behaviour
When I disable controls for a story (or all controls are null), I expect the “Control” column and the reload button into <argsTable>
component to disappear and the Control panel to be empty.
System
System:
OS: Windows 10 10.0.19043
CPU: (8) x64 Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
Binaries:
Node: 14.17.0 - C:\nodejs\node.EXE
npm: 6.14.13 - C:\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.423.0), Chromium (92.0.902.62)
npmPackages:
@storybook/addon-essentials: ^6.3.4 => 6.3.6
@storybook/addon-links: ^6.3.4 => 6.3.6
@storybook/addons: ^6.3.6 => 6.3.6
@storybook/html: ^6.3.4 => 6.3.6
@storybook/preset-scss: ^1.0.3 => 1.0.3
@storybook/theming: ^6.3.4 => 6.3.6
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:9
Top Results From Across the Web
Disabling controls for a story does not hide them on argsTable ...
Describe the bug When I set the controls parameter to { disabled: true } for a story, the "Control" column into <argsTable story="">...
Read more >Controls - Storybook - JS.ORG
To use the Controls addon, you need to write your stories using args. Storybook will automatically generate UI controls based on your args...
Read more >reactjs - @storybook/addon-controls: howto not auto-generate ...
disable within argTypes for a given arg. Suppose you have a story with foo and bar properties (auto-generated or otherwise) and you want...
Read more >storybook/addon-controls - npm
How can I disable controls for certain fields on a particular story? The argTypes annotation can be used to hide controls for a...
Read more >Next-level component showcasing with Storybook controls
args = { color: "#516dd0", };. Although it's not part of Storybook controls, I would like to say a few words about the...
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 Free
Top 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
@ops1ops Storybook docs are famously bad. They are more of a blog about storybook than a simple listing of api. I’m not sure why no one does this anymore.
Controls does not hidden on args table, for that exist another property.
If you want to hidde some property on table, you have to use table.
title: { table: { disable: true } }
You can check the documentation here