storybook: Controls: subcomponents doesn't show controls column in prop tables.
Describe the bug subcomponents doesn’t show controls column in prop tables.
To Reproduce
my component is like this, it has a father component ConditionPanel, and a child component Item which would be passed into ConditionPanel as children props.
While the father component is showing the controls column, the subcomponent isn’t.

Expected behavior show all the subcomponents controls, and be able to control the main story.
Screenshots

Code snippets
my x.story.jsfile
import React from 'react'
import ConditionPanel, { Item } from "../components/ConditionPanel/index";
import { Input } from 'antd'
export default {
title: 'UI/ConditionPanel',
component: ConditionPanel,
subcomponents: { 'ConditionPanel.Item': Item }
};
export const Main = (args) => (
<ConditionPanel {...args} >
<Item label="test101">
<Input placeholder="asdsad" style={{width: '100%'}}/>
</Item>
<Item label="test101">
<Input placeholder="asdsad" style={{width: '100%'}}/>
</Item>
<Item label="test101">
<Input placeholder="asdsad" style={{width: '100%'}}/>
</Item>
<Item label="test101">
<Input placeholder="asdsad" style={{width: '100%'}}/>
</Item>
<Item label="test101">
<Input placeholder="asdsad" style={{width: '100%'}}/>
</Item>
<Item label="test101">
<Input placeholder="asdsad" style={{width: '100%'}}/>
</Item>
</ConditionPanel>
);
System:
"@babel/core": "^7.10.5",
"@storybook/addon-actions": "^6.0.0-rc.29",
"@storybook/addon-controls": "^6.0.3",
"@storybook/addon-docs": "^6.0.3",
"@storybook/addon-knobs": "^5.3.19",
"@storybook/addon-links": "^5.3.19",
"@storybook/addon-notes": "^5.3.19",
"@storybook/addon-viewport": "^5.3.19",
"@storybook/addons": "^5.3.19",
"@storybook/react": "^6.0.3",
"babel-loader": "^8.1.0",
"babel-plugin-import": "^1.13.0",
"babel-plugin-react-docgen": "^4.1.0",
"storybook-addon-jsx": "^7.3.3",
"storybook-addon-react-live-edit": "^2.0.4",
"storybook-addon-smart-knobs": "^6.0.2",
"storybook-host": "^5.1.0",
"storybook-readme": "^5.0.8"
Additional context None
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 20
- Comments: 18 (2 by maintainers)
I wonder if an API like the below could work to automate this? 🤔
Having the same issue. I have
Cardcomponent, which I’ll use as a wrapper. I have a few other components - CardActions, CardImage, CardText and CardTitle, which I’ll use as children. I’d like to be able to use the Controls pannel to change the children’s args. The approach from the docs didn’t work for me. When I try to use the subcomponents field in the Card’s story, I see theArgs unsupported. See Args documentation for your framework.in the Docs panel.card.stories.jsx (removed business logic for simplicity)
Canvas panel:
Docs panel:
I tried to describe each subcomponent, like this:
The result was the same. Any with ideas are welcome
To achieve this you’ll need to customize the args for your story by hand: https://storybook.js.org/docs/react/essentials/controls#fully-custom-args
Any update on this? My company uses subcomponents.
+1
Any updates ?
+1
Any updates on that ?
+1, can’t get the subcomponents tab to show. Even with the exact same sample code from the docs.
+1
+1
+1
+1
Pretty nice @sami616 😻