Replies: 3 comments 2 replies
-
|
Storybook v8 infers controls more aggressively, which can lead to a spike in automatically generated controls for your components. To restrict the Controls panel to only the controls you explicitly define, you can use the export default {
title: 'Components / Buttons / Standard Button',
component: 'beacon-button',
argTypes: {
buttonText: 'Button',
variant: {
options: Object.values(CTAVariants),
control: { type: 'select' },
},
scale: {
options: [Scales.Mini, Scales.Normal, Scales.Jumbo],
control: { type: 'select' },
},
buttonTarget: {
options: ['_self', '_blank', '_parent', '_top'],
control: { type: 'select' },
},
},
args: {
disabled: false,
variant: CTAVariants.Primary,
scale: Scales.Normal,
},
parameters: {
controls: {
include: ['buttonText', 'variant', 'scale', 'buttonTarget'],
},
},
};Alternatively, you can use You can try these approaches to keep your Controls panel focused only on the fields you care about. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
@dosu Is there a way to turn off automatically generated controls? |
Beta Was this translation helpful? Give feedback.
-
|
@dosu I'm only including certain controls however I see a ton of autogenerated controls and the controls I included I can't interact with. Here's my code: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
When upgrading from v7 to v8 in storybook, I noticed a big spike in my component's controls'. Increasing from 9 to 58.
Here's my default export:
export default { title: 'Components / Buttons / Standard Button', component: 'beacon-button', argTypes: { buttonText: 'Button', variant: { options: Object.values(CTAVariants), control: { type: 'select' }, }, scale: { options: [Scales.Mini, Scales.Normal, Scales.Jumbo], control: { type: 'select' }, }, buttonTarget: { options: ['_self', '_blank', '_parent', '_top'], control: { type: 'select' }, }, }, args: { disabled: false, variant: CTAVariants.Primary, scale: Scales.Normal, }, };Is there a way to prevent these extra controls from appearing and ensure that only the controls defined in my default export are shown?
Additional information
No response
Create a reproduction
No response
Beta Was this translation helpful? Give feedback.
All reactions