Open ChazUK opened 2 years ago
And setting ArgTypes manually does work, so I'm not sure if it's an issue with compodoc or how Storybook handles that default.
<Meta
argTypes={{
size: {
table: {
defaultValue: { summary: 'Hello' },
},
control: { type: 'select' },
options: ['xs', 'sm', 'md', 'lg'],
}
}}
...
what happens if you set:
<Meta args={{ size: 'xs' }} />
Thanks for the quick reply. I'm actually trying to get the default straight out of the Component itself rather than setting anything in the stories file, and having duplicate info that dev's will forget to update.
I was trying to use <Props of={IconComponent} />
but just seen that it's going to be deprecated.
<Meta
title="Atoms/Icon"
component={IconComponent}
args={{ size: 'xs' }}
argTypes={{
icon: {
control: { type: 'select' },
options: completeIconSet.map((icon) => icon.name),
},
size: {
control: { type: 'select' },
options: ['xs', 'sm', 'md', 'lg'],
},
}}
/>
<Canvas>
<Story
name="Default"
args={{
icon: 'add',
size: 'xs',
}}
>
{Template.bind({})}
</Story>
</Canvas>
### Props
<Props of={IconComponent} />
### ArgsTable
<ArgsTable story="Default" />
Could this line https://github.com/storybookjs/storybook/blob/b88d2d92dae890f4fdec223f342fa0b8b0c19a31/lib/components/src/blocks/ArgsTable/ArgValue.tsx#L130
Perhaps be changed to
const summary = value.summary || value;
const detail = value.detail;
Also, what is the reason for deprecating the Props Component? It's quite useful when for instance documenting a component that has multiple children, like Tabs and TabItem. It can output the inputs / methods etc without creating a separate story whilst omitting the control functions?
Just looked through the props and found it can take of
https://github.com/storybookjs/storybook/blob/next/addons/docs/src/blocks/ArgsTable.tsx#L28-L30
@ChazUK we renamed Props
to ArgsTable
in 6.0 https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#previewprops-renamed
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
@shilman is there any plan to fix the defaultValue
issue?
@ChazUK Any interest in contributing a PR to solve this? We've documented how to contribute and there's also a #contributing
channel on the Storybook discord if you have questions.
@shilman I will give it a go
I'm using
@storybook/addon-essentials@6.3.0
and@storybook/angular@6.3.0
along with@compodoc/compodoc@1.1.16
to automatically generate documentation for my components.After configuring the docs to read the compodoc output I have noticed that none of the default values are shown in the table. When a default value is present in the code the hyphen is removed but no output shown.
I think I've nailed it down to this line https://github.com/storybookjs/storybook/blob/next/lib/components/src/blocks/ArgsTable/ArgValue.tsx#L135. The props passed in do not match the structure.
Description follows the structure
But then the default value structure is as follows
So the ArgSummary is returned as null.
Below is the section from my outputted documentation.json file from Compodoc
compodoc -p libs/eds-base/tsconfig.lib.json -e json -d libs/eds-base --disablePrivate --disableInternal --disableLifeCycleHooks --disableSourceCode