Git Product home page Git Product logo

babel-plugin-react-docgen's Introduction

babel-plugin-react-docgen

react-docgen allows you to write propType descriptions, class descriptions and access propType metadata programatically.

This babel plugin allow you to access those information right inside your React class.

For an example, let's say you've a React class like this:

/**
  This is an awesome looking button for React.
*/
import React from 'react';

export default class Button extends React.Component {
  render() {
    const { label, onClick } = this.props;
    return (
      <button onClick={onClick}>{ label }</button>
    );
  }
}

Button.propTypes = {
  /**
    Label for the button.
  */
  label: React.PropTypes.string,

  /**
    Triggered when clicked on the button.
  */
  onClick: React.PropTypes.func,
};

With this babel plugin, you can access all these information right inside your app with:

console.log(Button.__docgenInfo);
Click to see the output
{
  description: 'This is an awesome looking button for React.',
  props: {
    label: {
      type: {
        name: 'string'
      },
      required: false,
      description: 'Label for the button.'
    },
    onClick: {
      type: {
        name: 'func'
      },
      required: false,
      description: 'Triggered when clicked on the button.'
    }
  }
}

This will be pretty useful for documentations and some other React devtools like Storybook.

Usage

Install the plugin:

npm install -D babel-plugin-react-docgen

Use it inside your .babelrc

{
  "plugins": ["react-docgen"]
}

.babelrc Options

option description default
resolver You may use the 3 built-in react-docgen resolvers by specifying its name as a string, or you may specify a custom resolver by specifying the function explicitly. "findAllExportedComponentDefinition"
handlers All react-docgen handlers are automatically applied. However, custom handlers can be added by specifying them here. Any string value will be loaded by require, and a function will be used directly.
removeMethods Used to remove docgen information about methods. false
DOC_GEN_COLLECTION_NAME The name of a global variable where all docgen information can be stored. See below for more information.
...options Remaining options will be passed directly as react-docgen options. Any options they allowed will be passed through, but the filename will be overwritten by the filename provided by babel.

Collect All Docgen Info

Sometimes, it's a pretty good idea to collect all of the docgen info into a collection. Then you could use that to render style guide or similar.

So, we allow you to collect all the docgen info into a global collection. To do that, add following config to when loading this babel plugin:

{
  "plugins":[
    [
      "babel-plugin-react-docgen",
      {
        "DOC_GEN_COLLECTION_NAME": "MY_REACT_DOCS",
        "resolver": "findAllComponentDefinitions", // optional (default: findAllExportedComponentDefinitions)
        "removeMethods": true, // optional (default: false)
        "handlers": ["react-docgen-deprecation-handler"] // optional array of custom handlers
      }
    ]
  ]
}

Then you need to create a global variable(an object) in your app called MY_REACT_DOCS before any code get's executed. Then we'll save them into that object. We do it by adding a code block like this to the transpiled file:

if (typeof MY_REACT_DOCS !== 'undefined') {
  MY_REACT_DOCS['test/fixtures/case4/actual.js'] = {
    name: 'Button',
    docgenInfo: Button.__docgenInfo,
    path: 'path/to/my/button.js'
  };
}

Compile Performance

We parse your code with react-docgen to get this info, but we only do it for files which contain a React component.

There will be some overhead to your project, but you can leverage babel's cache directory to avoid this a huge performance hit.

Output Size

Yes this increase the output size of your transpiled files. The size increase varies depending on various factors like:

  • How many react classes you've
  • Amount of docs you've written
  • Amount of propTypes you've

Most of the time, you need this plugin when you are developing your app or with another tool like Storybook. So, you may not need to use this on the production version of your app.

babel-plugin-react-docgen's People

Contributors

abrad45 avatar arunoda avatar clehnert-psl avatar danielduan avatar dependabot[bot] avatar ethancrook99 avatar fatemehostad avatar flipace avatar jimmyandrade avatar jsanchez034 avatar lawliet29 avatar lflpowell avatar lttb avatar luujam avatar madushan1000 avatar ndelangen avatar onigoetz avatar patricklafrance avatar phated avatar salmanm avatar shilman avatar siddharthkp avatar stof avatar vpicone avatar wuweiweiwu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

babel-plugin-react-docgen's Issues

Docs aren't rendered for the default export when there are other exports in the same file

This seems to be related to this issue, but I'm opening this since that was closed over a 6 months ago.

I see that when exporting multiple components from a single file. Docs aren't rendered at allβ€”even for the default exported component. Based on the comments above, it seems the expected behavior would be that docs are rendered the default export only, but no docs are rendered.

This can be tested by exporting a component in addition to the default export. For example, in test/fixtures/case5/actual.js:

import React, { PropTypes } from 'react'

export const Second = () => (
  <div>Sample</div>
)

const First = ({ children }) => (
  <div>
    { children }
    <Second />
  </div>
)

First.propTypes = {
  children: PropTypes.node
}

export default First

Note the export const Second

In this case, First.__docgenInfo does not exist.

Error: Cannot find module 'recast'

npm -v 5.6-5.8
node -v 8.9.4

you have recast in devDependencies, but you are using this module in general file. In some case I don't get module on top of node_modules tree. and it doesn't exist in node_modules of babel-plugin-react-docgen. it only exist in react-docgen node_modules. Please, add recast in dependencies.

"Property value expected type of" error for an unnamed function

Hi,

I not sure if this one relates to here or babel-types but I hope someone here will be able to direct me to the right address.

I'm using @storybook/[email protected].
When running npm run storybook I'm tackled with the error below (real filenames obfuscated):

ERROR in ./app/path/to/components/Component.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: c:/dev/myapp/app/path/to/components/Component.js: Property value expected type of string but got null
    at Object.validate (c:\dev\app\node_modules\babel-types\lib\definitions\index.js:161:13)
    at validate (c:\dev\myapp\node_modules\babel-types\lib\index.js:505:9)
    at Object.builder (c:\dev\myapp\node_modules\babel-types\lib\index.js:466:7)
    at injectDocgenGlobal (c:\dev\myapp\node_modules\babel-plugin-react-docgen\lib\index.js:93:354)
    at c:\dev\myapp\node_modules\babel-plugin-react-docgen\lib\index.js:80:5
    at Array.forEach (<anonymous>)
    at injectReactDocgenInfo (c:\dev\myapp\node_modules\babel-plugin-react-docgen\lib\index.js:74:17)
    at PluginPass.exit (c:\dev\myapp\node_modules\babel-plugin-react-docgen\lib\index.js:14:11)
    at newFn (c:\dev\myapp\node_modules\babel-traverse\lib\visitors.js:276:21)
    at NodePath._call (c:\dev\myapp\node_modules\babel-traverse\lib\path\context.js:76:18)
 @ ./app/path/to/components/AnotherComponent.js 17:0-88 225:10-27
 @ ./stories/somesection.stories.js
 @ ./stories/index.stories.js
 @ ./.storybook/config.js
 @ multi ./node_modules/@storybook/core/dist/server/config/polyfills.js ./node_modules/@storybook/core/dist/server/config/globals.js ./.storybook/config.js (webpack)-hot-middleware/client.js?reload=true

After some research it appears that Component.js directly exports an unnamed function like this:

export default (data) => (
  data.map(node => <div>{node.content}</div>)
)

When changing it to

const func = (data) => (
  data.map(node => <div>{node.content}</div>)
)

export default func

Everything's good.
But it still looks like an issue cause there's nothing wrong with the first snippet as far as I understand.

Update to babel 7?

Hi,

I'm having issues w/ this plugin (which is loaded by other addons) since it's based on babel 6. Any plans to update this?

Thanks

Multiple components in the same file

It appears to be a bug, but when I have multiple components on the same file, the docgen info is not beeing attached to the component's class.

I'll try and investigate further.

Support flow type props validation

Did you have any plan to support:

export default class Item extends React.Component { // eslint-disable-line
  props: {
    icon: string,
    tooltip?: string,
    onClick?: () => void,
  };

  render() {
    const { icon, tooltip, onClick } = this.props
    return (
      <span className={styles.root} onMouseDown={onClick} title={tooltip}>
        <span className="material-icons">{icon}</span>
      </span>
    )
  }
}

together with

  static propTypes = {
    icon: React.PropTypes.string.isRequired,
    tooltip: React.PropTypes.string,
    onClick: React.PropTypes.func,
  };

Are we open to changing the test file names?

When working on the last PR, I noticed that the test/fixtures file names were not as clear as I would like. For example, the test source files are named actual.js. I would expect these to be named source.js and any generated output to be named actual.js. expected.js would stay the same. This would also allow for an npm command that generates actual.js without overwriting the existing fileβ€”enabling easier comparison between the two. If this is something you are open to, I can create a PRβ€”it is basically ready to go.

I cannot get it to work with flow

This is my package.json

    "babel-plugin-react-docgen": "^1.8.2",
    "@storybook/addon-actions": "^3.3.12",
    "@storybook/addon-backgrounds": "^3.3.12",
    "@storybook/addon-info": "^3.3.12",
    "@storybook/addon-knobs": "^3.3.12",
    "@storybook/addon-links": "^3.3.12",
    "@storybook/addons": "^3.3.12",
    "@storybook/react": "^3.3.12",

babelrc

{
  "presets": ["env", "react"],
  "plugins": ["react-docgen", "transform-class-properties"]
}

Component

// @flow
import React, { type Node } from 'react'
type Props = {
  children: Node,
}

const Component = ({ children, vertical, horizontal }: Props) => (
  <div>
    {children}
  </div>
)

Component.displayName = 'Component'

export default Component

but Component.__docgenInfo is always undefined.

I am not sure what i am doing wrong.

Support for method detection

Though there is no mention of this in the react-docgen README, in addition to prop detection it technically supports method detection as well (see react-docgen#17).

I can't seem to get the plugin to recognize a doc block for a method. Is there a reason that method info is not included via this plugin?

Add all these docgen info into a global array

We need maintain a global array which contains all these docgen Info in a single place. This will help us to create a directory of classes.

So, at end of each React class we need to push a code block like this:

class MyButton extends React.Component {
    render() {}
}

if (typeof STORYBOOK_REACT_CLASSES !== 'undefined') {
   STORYBOOK_REACT_CLASSES.push({
     'name': 'MyButton',
     'docgenInfo': {},
     'path': 'path of the component (from the root of the project)'
   });
}

This is something optional and enabled with a flag. We also need to get the variable name STORYBOOK_REACT_CLASSES from the outside.

Update `actualNameHandler` to remove FB patent license

The actualNameHandler.js still refers to the BSD+FB patent grant licence although the latest version of the file that was based on (in react-docgen) is now licensed as MIT.

Inclusion of the original licence makes usage problematic for some projects.

Avoid JSON stringifying

Currently we put the stringified version of the docgenInfo.
So, we have to do JSON.stringify

It's much better to avoid it in terms of usability and performance wise.

Problem with storybook and HOC

Running storybook throws an error in babel-plugin-react-docgen in the code below

export default function Modal (component) {
    return class extends component {
        constructor (...args) {
            super(...args) ;
            ....
            }

        ......
        }
    }

ERROR in ./src/lib/modal.js
Module build failed: TypeError: /tmp/react/src/lib/modal.js: Cannot read property 'name' of null
    at PluginPass.Class (/tmp/react/node_modules/@kadira/storybook/node_modules/babel-plugin-react-docgen/lib/index.js:18:37)
    at newFn (/tmp/react/node_modules/babel-core/node_modules/babel-traverse/lib/visitors.js:276:21)
    at NodePath._call (/tmp/react/node_modules/babel-core/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (/tmp/react/node_modules/babel-core/node_modules/babel-traverse/lib/path/context.js:48:17)
    at NodePath.visit (/tmp/react/node_modules/babel-core/node_modules/babel-traverse/lib/path/context.js:105:12)
    at TraversalContext.visitQueue (/tmp/react/node_modules/babel-core/node_modules/babel-traverse/lib/context.js:150:16)
    at TraversalContext.visitSingle (/tmp/react/node_modules/babel-core/node_modules/babel-traverse/lib/context.js:108:19)
    at TraversalContext.visit (/tmp/react/node_modules/babel-core/node_modules/babel-traverse/lib/context.js:192:19)
    at Function.traverse.node (/tmp/react/node_modules/babel-core/node_modules/babel-traverse/lib/index.js:114:17)
    at NodePath.visit (/tmp/react/node_modules/babel-core/node_modules/babel-traverse/lib/path/context.js:115:19)
 @ ./src/containers/campaign/savecampaign/savecampaign.js 17:13-42

If i change the return to just the function argument the storybook runs OK.

If I edit /tmp/react/node_modules/@kadira/storybook/node_modules/babel-plugin-react-docgen/lib/index.js and insert a check about line 17 then again storybook runs.

    ....
    }
    if (!path.parentPath.node.id) {
      return;
    }
    var className = path.parentPath.node.id.name;
    ....

I'm guessing docgen is missing a particular case?

Hope this makes sense (and is readable ....)

The issue with forwardRef Component

Following Component won't have __docgenInfo.Because of the isReactForwardRefCall in react-docgen not recognize forwardRef(...). We get the ast base on (props, ref) => {...}.The actualNameHandler can't the right name we need.

import React, { forwardRef } from 'react';
import PropTypes from 'prop-types';

const Text = forwardRef((props, ref) => {
  return (
    <div>text</div>
  );
});

Text.defaultProps = {
  onClick: PropTypes.func,
  children: PropTypes.node,
  style: PropTypes.object,
};

export default Text;

Support HOCs that wrap & export component

No documentation is produced if a component is wrapped before being exported, e.g. using redux connect.

I've tried using different resolvers but this doesn't fix the problem. I can see in the react-docgen codebase history that they have added support for HOCs, so I believe this limitation must be specific to this plugin.

How to docgen for an npm package?

I recently refactored my docs out of my npm UI package and made a separate repository for my docs. I am not seeing the __docgenInfo on the components and I believe that is because they are being imported from node_modules in the docs now. Is there a configuration that I am missing to parse these components in node_modules?

Upgrade to `[email protected]`

  • Determine if 3.0 is compatible
  • Migrate code if needed
  • Test in storybook example app and other projects

Waiting for final 3.0 release.

If using reacts injectIntl to wrap component __docgenInfo is undefined

Hi, I have been going through some open issues in react-docgen and some closed issues here about HOC's not having docgenInfo and I could not find solution.

I understand its not trivial, but did someone find a way how to solve this problem?

Basically the moment I will use injectIntl to wrap any component I will lose docgenInfo.

Example:

import * as React from 'react';
import { injectIntl } from 'react-intl';

class Component extends React.Component<Props, void> {
...
}

export default injectIntl(Component);
import Component from './Component';

console.log(Component.__docgenInfo); // is undefined

I am using

"babel-plugin-react-docgen": "2.0.0",
"react-docgen": "3.0.0-rc.1"

Thanks

Does not work with `class` Components

I am trying to extract prop-types info from a component in storybook.
I am using the default babel-plugin-react-docgen that comes baked in to @storybook/[email protected] which is at version 2.0.0
It looks like that uses [email protected]

When I console.log(Component.__docgenInfo) in a story file for a Component that is defined with class:

class Component extends React.Component {...}

When I do the same thing in a story file for a Component that is defined with function, everything seems to work as expected.

function Component() {...}

However, if I use react-docgen cli to generate the docgen info, I get all of the expected info from the class based Component.

npx react-docgen ./src/components/Component.jsx

Any help would be appreciated on why this might not be working.

I tried to just generate/parse the react docgen in the story file without the babel plugin, but I can't seem to get the full untranspile source from the story file.


Here is my .babelrc

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "useBuiltIns": "usage"
      }
    ],
    "@babel/preset-react"
  ],
  "plugins": [
    "transform-class-properties",
    [
      "module-resolver",
      {
        "root": ["."],
        "alias": {
          "storybook": ["./.storybook"]
        }
      }
    ]
  ]
}
  • babel-plugin-react-docgen is coming from storybook, but I did try to add it with a custom name, still no luck.
  • I tried removing transform-class-properties to no avail

[Question] babel-plugin-react-docgen-typescript alternatives ?

Hello,
We were using babel-plugin-react-docgen-typescript which uses babel-plugin-react-docgen.
But babel-plugin-react-docgen-typescript is outdated (sept. 2020) and it doesn't work with the latest major of babel-plugin-react-docgen.

I was wondering if anyone is using a different tool/setup/config to make babel-plugin-react-docgen work with typescript sources.

Thank you

Cannot pass Babel parser options to react-docgen

react-docgen doesn't work for my code which has decorator before export:

import React from 'react';

const decorate = Wrapped => Wrapped;

@decorate
export default class Example extends React.Component {
    render() {
        return <div>Example</div>;
    }
}

I tracked down the react-docgen code to here:

https://github.com/reactjs/react-docgen/blob/8028dad6c727eafafe7fb79113d43e261209311e/src/babelParser.js#L81-L86

and the babel-plugin-react-docgen code to here:

docgenResults = ReactDocgen.parse(code, resolver, handlers, {
filename,
});

Since babel-plugin-react-docgen only passes {filename} as options, react-docgen always receives parserOptions: undefined. Consequently, react-docgen always uses its default plugins, which set decoratorsBeforeExport: false.

Is it possible for babel-plugin-react-docgen to pass parserOptions to react-docgen, so that I can override the default plugins with my plugins? For example, I confirmed that the following fixes my problem:

docgenResults = ReactDocgen.parse(code, resolver, handlers, {
  filename,
  parserOptions: state.file.opts.parserOpts,
});

I am using Babel via Webpack and babel-loader, not .babelrc.

Named exports with declarations are ignored

Consider the following component:

import React from 'react';
import PropTypes from 'prop-types';

export const Button = ({text, onClick}) => (
    <button onClick={onClick}>{text}</button>
);

Button.propTypes = {
    text: PropTypes.string,
    onClick: PropTypes.func
}

babel-plugin-react-docgen ignores such a declaration because isExported function looks specifically for ExportNamedDeclaration with a specifier, i.e. export {Button} or export {Button as GlobalSpecifierButton}.

Is this expected behavior?
I'm currently patching babel-plugin-react-docgen manually to work with named exports with declarations, so I could submit a pull request with a fix.

[Bug] docgen works with start-storybook but not build-storybook

Describe the bug

When I invoke start-storybook, my component's props are extracted correctly and the Description/ArgsTable are populated correctly. When I invoke build-storybook with the same configuration used in start-storybook, it fails and no inputs are found.

Is there something that would result in these different behaviors when building for production vs dev server? Interestingly, our configs seem to work fine for both building and dev server with TypeScript components - but Flow typed components seem to only work when using the dev server

Cannot define custom resolver

I need to define custom resolver, but it only allows to pick between

  • findAllComponentDefinitions
  • findExportedComponentDefinition
  • findAllExportedComponentDefinitions

It should be like handler, where we can define custom resolver and require should take care of it.

I believe it can be easily accomplished by modifying:

resolver = ReactDocgen.resolver[state.opts.resolver];

Dependency Version Update (react-docgen)

What would it take to update the react-docgen dependency to 5.3.0? Related to this issue, prop tables are still missing props for components that use optional chaining. I tried to update it myself, but I found that all the tests started to fail when I updated to 5.3.0 and I couldn't identify what change made that happen.

Does not work in my case if I use the babel configuration in webpack

Use webpack.config

use: {
          loader: 'babel-loader',
          options: {
            presets: ['env', 'react'],
            plugins: [
              'transform-class-properties',
              'react-docgen'
            ]
          }
        }
class Doc extends PureComponent {
  static defaultProps = {
    name: 'stranger'
  };

  static propTypes = {
    name: PropTypes.string
  };
  render() {
    return <div>123</div>;
  }
}

return Doc.__docgenInfo = undefined

Flow prop documentation breaks when class property functions with optional parameters are used

This piece of code renders No propTypes defined! in the info:

// @flow
import React from 'react'

type PropsType = {
  /** The text to be rendered in the button */
  label: number,
}

class FlowTypeButton extends React.Component<PropsType> {
  foo = (bar?: string) => {
    console.log(bar)
  }

  render() {
    return <button>{this.props.label}</button>
  }
}

export default FlowTypeButton

If I remove the question mark, the prop type description is rendered correctly:

foo = (bar: string) => {
property propType required default description
label number yes - The text to be rendered in the button

Tested on v1.8.2 of babel-plugin-react-docgen and reproduced in storybook of both v3.4.0-alpha.7 and v3.3.12.

1.8.0 throws a large amount of errors

Once i updated from 1.7.0, running Storybook with docgen would drown my terminal in traversel errors. Spend some time trying to figure out what was causing this, trying to set the different resolvers, etc.

Turns out the issue is the add console.error that logs everything.
https://github.com/storybooks/babel-plugin-react-docgen/blob/735a80bca397df11295952e13bdd36171a043f56/src/index.js#L150

Since react-docgen just throws errors whenever it tries to parse files without React components, and the babel plugin is applied to all files, i believe it should just accept this errors. Maybe add a verbose or debug option if it is actually useful to see the stack?

IsStatelessComponent returning false on valid component

I have this component which has the react syntax transpiled:

import React from 'react';
import PropTypes from 'prop-types';

const Kitten = ({ isWide, isLong }) => React.createElement('img', { width: isWide ? '500' : '200', height: isLong ? '500' : '200', src: 'http://placekitten.com.s3.amazonaws.com/homepage-samples/200/287.jpg' });

Kitten.propTypes = {
  /** Whether the cat is wide */
  isWide: PropTypes.bool,
  /** Whether the cat is long */
  isLong: PropTypes.bool
};

Kitten.defaultProps = {
  isWide: false,
  isLong: false
};

export default Kitten;

This plugin doesn't call react-docgen since it doesn't consider it as a react component. However when I parse it directly using react-docgen I get the docgen info. Is it possible to be able to configure the babel plugin to accept this component format? Thanks

Plugin not generating docgen for flow types

Current docgen has issue with flow syntax like this:

type Colors =
    |  'text'
    | 'primary'
    | 'accent'
    | 'error'
    | 'success'
    | 'warning'
    | 'info'
    | 'additional'
    | 'minor';

which is perfectly fine syntax, but it is crashing on first pipe. #236. With beta version it is working as expected. Can i somehow configure this plugin to use beta version of docgen with storybook? Right now i can use only workaround without using first pipe.

`export default Component` and functional components declared with `function()` do not work

I've been looking at this for two days without any progress so I thought I'd bring the problem here. Does anything jump out is invalid to you guys?

Versions

react-docgen: 3.0.0-beta6
babel-plugin-react-docgen: 1.7.0

Babelrc

{
  "presets": [
    "react",
    "es2015"
  ],
  "plugins": [
    "react-docgen",
    "transform-decorators-legacy",
    "transform-class-properties",
    "transform-object-rest-spread",
    "transform-function-bind",
    "transform-runtime"
  ]
}

Source

import React from 'react';
import PropTypes from 'prop-types';
import { processProps } from '../utilities';

export default function Button(props) {
  return <button {...processProps(props)} />;
}

Button.propTypes = {
  /**
   * Breakpoint where button changes to block
   **/
  block: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', true]),
  /**
   * Color class
   **/
  color: PropTypes.oneOf(['primary', 'secondary', 'tertiary']),
  /**
   * Size class
   **/
  size: PropTypes.oneOf(['baby', 'mama', 'papa']),
  /**
   * Add additional CTA specific styles -- Only applies to Button components
   */
  isCTA: PropTypes.bool,
  /**
   * The button's content
   */
  children: PropTypes.node
};

Problem

Not getting __docgenInfo property on component constructor.
screen shot 2017-08-13 at 10 51 58 am

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.