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.

addon-docs: "No props found for this component" when component is exported in camelCase

See original GitHub issue

Describe the bug

Props table is empty when the default exported variable of the component file was in the camel case format.

Code snippets

Here is my MDX file:

icon-button.stories.mdx

import { Meta, Props } from '@storybook/addon-docs/blocks';
import IconButton from './icon-button';

<Meta
  component={IconButton}
  title="IconButton"
/>

## Props

<Props of={IconButton} />

And here is my component:

Not working when the default exported variable is “iconButton”

icon-button.tsx

import PropTypes from 'prop-types';
import React, { FC } from 'react';
import './icon-button.scss';

export interface IProps {
  /**
   * button color
   */
  color?: string;
}

const iconButton: FC<IProps> = function IconButton(props) {
  return <div className="icon-button">icon-button</div>;
};

iconButton.propTypes = {
  color: PropTypes.string,
};

iconButton.defaultProps = {
  color: 'primary',
};

export default iconButton;

Not it works after I changed the default exported variable to “iconbutton”

icon-button.tsx

import PropTypes from 'prop-types';
import React, { FC } from 'react';
import './icon-button.scss';

export interface IProps {
  /**
   * button color
   */
  color?: string;
}

const iconbutton: FC<IProps> = function IconButton(props) {
  return <div className="icon-button">icon-button</div>;
};

iconbutton.propTypes = {
  color: PropTypes.string,
};

iconbutton.defaultProps = {
  color: 'primary',
};

export default iconbutton;

Screenshots

2020-01-21 12-46-32 2020-01-21 12_48_57

Expected behavior Should still work with camelCase

System:

System: OS: macOS Mojave 10.14.4 CPU: (4) x64 Intel® Core™ i7-4578U CPU @ 3.00GHz Binaries: Node: 10.16.3 - /usr/local/bin/node Yarn: 1.21.1 - ~/.yarn/bin/yarn npm: 6.13.4 - /usr/local/bin/npm Browsers: Chrome: 79.0.3945.130 Firefox: 70.0.1 Safari: 12.1 npmPackages: @storybook/addon-a11y: ^5.3.7 => 5.3.7 @storybook/addon-actions: ^5.3.7 => 5.3.7 @storybook/addon-docs: ^5.3.7 => 5.3.7 @storybook/addon-jest: ^5.3.7 => 5.3.7 @storybook/addon-knobs: ^5.3.7 => 5.3.7 @storybook/addons: ^5.3.7 => 5.3.7 @storybook/core: ^5.3.7 => 5.3.7 @storybook/react: ^5.3.7 => 5.3.7

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sidhukocommented, Feb 20, 2020

OP could you try changing your code to use import * as React from 'react';?

0reactions
stale[bot]commented, Aug 8, 2020

Hey there, it’s me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

Read more comments on GitHub >

github_iconTop Results From Across the Web

StoryBook addon-docs: "No props found for this component ...
I was able to solve this issue, basically I had misconfigured the webpack.config.js for StoryBook,
Read more >
Storybook Addon-Docs: "No Props Found For This ... - ADocLib
and returns No props found for this component, But when I create dumb file You ... exported variable of the component file was...
Read more >
Component Story Format (CSF) - Storybook
Every component story file consists of a required default export and one or more named exports. CSF is supported in all frameworks except...
Read more >
https://amlormusic.com/wp-content/plugins/gutenber...
([38092](https://github.com/WordPress/gutenberg/pull/38092)) * Component: Update color-picker ... Various - Add button text when no colors found.
Read more >
Documenting design systems with Storybook Docs
default export — metadata that describe the components ... import { Canvas, Meta, Story } from '@storybook/addon-docs/blocks' ...
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