Document React <components /> in JSON format



react-docgen is a highly customizable library that extracts information from React components and returns this information in a structured machine-readable format from which documentation can be generated.

It uses Babel to parse the source into an AST and provides methods to process this AST to extract the desired information. The output / return value is a JSON blob / JavaScript object.

It provides a default implementation for React components defined via React.createClass, ES2015 class definitions or functions (stateless components).

react-docgen is a low-level tool to extract information about react components. If you are searching for a full-fledged style guide with an actual interface check out some of the tools that are using react-docgen. You can find a list of tools on this page