Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to render custom ArgsTable #13944

Closed
mkrds opened this issue Feb 17, 2021 · 2 comments
Closed

Unable to render custom ArgsTable #13944

mkrds opened this issue Feb 17, 2021 · 2 comments

Comments

@mkrds
Copy link

mkrds commented Feb 17, 2021

Describe the bug
After the update from version 5 to 6.x import { PropsTable } from '@storybook/components' component is no longer available and I'm trying to replicate it with the new import { ArgsTable } from "@storybook/addon-docs/blocks" with no luck.

Why do I even need it? Well in our open source component library we have created an util that helps us with documenting props of styled-system package because prop-types that are being spread from another package does not render properly in storybook.

Here's the util:
https://github.com/Sage/carbon/blob/master/.storybook/utils/styled-system-props.js#L468

This util is then used directly in *.mdx files like that:

<StyledSystemProps of={Select} margin />

In SB5 this generated 2 propTables, one for the props defined directly on the component, and the second one which is created manually with the styled-system props.

Expected result of that can be seen at the bottom of this page: https://carbon.sage.com/?path=/docs/design-system-select--controlled

So after updating to SB6 I've done some digging and after finding this comment #11105 (comment)
I tried using the ArgsTable with properly structured rows prop (but without story or component props) to create a custom ArgsTable, but no matter what I do I always end up with No inputs found for this component. Read the docs error message. I even tried copy pasting the code from https://next--storybookjs.netlify.app/official-storybook/?path=/docs/docs-argstable--normal but still I get the same message all the time.

So to sum up:
<ArgsTable of={Component} /> works fine but <ArgsTable rows={...} /> does not in mdx files

To Reproduce
I hope I described it well enough in the section above.

Expected behavior
I'd like to see my custom defined ArgsTable

System
System:
OS: macOS 11.1
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Binaries:
Node: 12.16.1 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.8 - ~/Code/carbon/node_modules/.bin/npm
npmPackages:
@storybook/addon-a11y: ^6.1.18 => 6.1.18
@storybook/addon-actions: ^6.1.18 => 6.1.18
@storybook/addon-docs: ^6.1.18 => 6.1.18
@storybook/addon-google-analytics: ^6.1.18 => 6.1.18
@storybook/addon-knobs: ^6.1.18 => 6.1.18
@storybook/addon-links: ^6.1.18 => 6.1.18
@storybook/addon-viewport: ^6.1.18 => 6.1.18
@storybook/addons: ^6.1.18 => 6.1.18
@storybook/components: ^6.1.18 => 6.1.18
@storybook/react: ^6.1.18 => 6.1.18
@storybook/theming: ^6.1.18 => 6.1.18

@mkrds
Copy link
Author

mkrds commented Feb 18, 2021

After doing some more digging I've noticed that it actually works, but the ArgsTable has to be imported:
import { ArgsTable } from "@storybook/components"
instead of
import { ArgsTable } from "@storybook/addon-docs/blocks"
to be able to pass other props like rows or error.
Kinda hard to find it in documentation tbh :)

@shilman
Copy link
Member

shilman commented Feb 20, 2021

@mkrds those @storybook/components components are undocumented internal APIs subject to change. the doc blocks from @storybook/addon-docs/blocks are the public APIs. Documentation is thin, but will be getting better https://storybook.js.org/docs/react/writing-docs/doc-blocks

@shilman shilman closed this as completed Feb 20, 2021
@storybookjs storybookjs locked and limited conversation to collaborators Feb 20, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants