question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PropsTable shows only args or "Nothing found"

See original GitHub issue

Describe the bug

Storybook does not register propTypes. Only Component.args are picked up by the PropsTable

image

Example component:

export const SIZES = { XS: 'XS', SM: 'SM', MD: 'MD', LG: 'LG' };

const propTypes = {
  /**
   Size of the text
   */
  size: PropTypes.oneOf(...Object.values(SIZES)),
  as: PropTypes.string,
  className: PropTypes.string,
  children: PropTypes.node.isRequired,
};

const MarketingHeading = styled(RawHeading)`
  ${baseStyles}
`;

MarketingHeading.propTypes = propTypes;

export { MarketingHeading };

full gist of the component: https://gist.github.com/qoalu/604dedd2ad868b7ddf67c093fbed6e38

Configs

main.js

module.exports = {
  stories: ['../src/**/*.stories.@(js|mdx)', '../src/**/*.story.@(js|mdx)'],
  addons: [
    '@storybook/preset-create-react-app',
    {
      name: '@storybook/addon-docs',
      options: {
        configureJSX: true,
        babelOptions: {},
      },
    },
    '@storybook/addon-essentials',
    '@storybook/addon-knobs',
    '@storybook/addon-storysource',
    '@storybook/addon-controls',
    '@storybook/addon-viewport',
    '@storybook/addon-backgrounds',
    '@storybook/addon-actions',
    '@storybook/addon-toolbars',
  ],
};

.storybook/.babelrc

{
  "presets": ["@babel/env", "@babel/react"],
  "plugins": [
    "babel-plugin-styled-components",
    "macros",
    "@babel/plugin-proposal-class-properties",
    [
      "module-resolver",
      {
        "root": ["./"],
        "alias": {
          "ui-kit": "./src"
        }
      }
    ]
  ]
}

System Environment Info:

System: OS: macOS 10.15.7 CPU: (12) x64 Intel® Core™ i7-8750H CPU @ 2.20GHz Binaries: Node: 12.18.0 - ~/.nvm/versions/node/v12.18.0/bin/node Yarn: 1.22.5 - ~/.yarn/bin/yarn npm: 6.14.9 - ~/Documents/Work/ui-kit/node_modules/.bin/npm Browsers: Chrome: 90.0.4430.85 Safari: 14.0.3 npmPackages: @storybook/addon-a11y: ^6.2.8 => 6.2.8 @storybook/addon-actions: ^6.2.8 => 6.2.8 @storybook/addon-backgrounds: ^6.2.8 => 6.2.8 @storybook/addon-contexts: ^5.3.21 => 5.3.21 @storybook/addon-controls: ^6.2.8 => 6.2.8 @storybook/addon-docs: ^6.2.8 => 6.2.8 @storybook/addon-essentials: ^6.2.8 => 6.2.8 @storybook/addon-info: ^5.3.21 => 5.3.21 @storybook/addon-jest: ^6.2.8 => 6.2.8 @storybook/addon-knobs: ^6.2.8 => 6.2.8 @storybook/addon-links: ^6.2.8 => 6.2.8 @storybook/addon-notes: ^5.3.21 => 5.3.21 @storybook/addon-options: ^5.3.21 => 5.3.21 @storybook/addon-storysource: ^6.2.8 => 6.2.8 @storybook/addon-toolbars: ^6.2.8 => 6.2.8 @storybook/addon-viewport: ^6.2.8 => 6.2.8 @storybook/addons: ^6.2.8 => 6.2.8 @storybook/preset-create-react-app: ^3.1.7 => 3.1.7 @storybook/react: ^6.2.8 => 6.2.8 @storybook/source-loader: ^6.2.8 => 6.2.8 @storybook/theming: ^6.2.8 => 6.2.8

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
evan01commented, Apr 27, 2021

Having the same issue but with typescript. I just upgraded from 6.1.20 --> 6.2.8 and this issue happened. We had been relying on the automatic prop descriptions that came from the component itself.

6.2.8 image

6.1.20 image

Before this update, storybook would pick up the descriptions from the comments above the props like so…

image

0reactions
alexandreabehcommented, Aug 17, 2021

+1 on this

Read more comments on GitHub >

github_iconTop Results From Across the Web

PropsTable shows only args or "Nothing found" #14682
Describe the bug. Storybook does not register propTypes. Only Component.args are picked up by the PropsTable. image. Example component:
Read more >
ArgsTable - Storybook - JS.ORG
Storybook Docs automatically generates component args tables for components in ... a type display with a dropdown that shows the detail, and no...
Read more >
Property 'args' does not exist on type (args: Props)
You need to use the Typescript version, it's an option in the docs now (https://storybook.js.org/docs/react/get-started/whats-a-story), ...
Read more >
Manual:Page props table - MediaWiki
The page_props table contains properties about pages set by the parser via ParserOutput::setProperty() , such as the display title and the ...
Read more >
api - UI Builder - ServiceNow Developers
This object must conform to the data resource's input parameters. Returns. Type, Description. None. Example. This code shows a page script that is ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found