react-docgen is an MIT-licensed TypeScript library, plus a companion command-line interface, that reads React component files and returns structured, machine-readable information about them so that documentation can be generated from the source.
What it is
react-docgen is a highly customizable extraction library for the React ecosystem. It walks React component files, pulls out information about those components, and returns that information in a structured, machine-readable format. The library lives in packages/react-docgen/ inside the reactjs/react-docgen repository, and @react-docgen/cli in packages/react-docgen-cli/ is a thin CLI wrapper around it, so the same extraction can be driven from the command line instead of from code. The project sits under the Content & Publishing / Documentation & Knowledge Base category, is written in TypeScript, and is licensed under the MIT License.
The problem it solves is the gap between component source code and component documentation. Documentation tools need to know what a component accepts and how it is shaped, but that information is locked inside the source file. react-docgen replaces hand-maintained descriptions of component APIs and per-project parsing code by reading the components directly and emitting a structured result in JSON that a documentation generator can consume. It does not render pages or host a site; it produces the intermediate data layer that a documentation generator builds on, which is why the output format is machine-readable rather than human-facing.
Key capabilities
- Extracts information from React component files and returns it in a structured, machine-readable format suitable for documentation generation.
- Emits JSON, as indicated by the project's
json topic, so downstream documentation generators can consume the output.
- Ships
@react-docgen/cli as a command-line wrapper around the library, allowing react-docgen to be run on the command line.
- Exposes
react-docgen as a library in packages/react-docgen/, so extraction can be embedded programmatically rather than only via CLI.
- Describes itself as highly customizable, meaning extraction behaviour is configurable rather than fixed.
- Published under the MIT License, permitting reuse inside commercial and open-source documentation pipelines.
- Documented at react-docgen.dev for version 6.x and newer, with a separate README on the 5.x branch for version 5.x.
Who uses it and how
- Documentation teams that need a generated component reference rather than a hand-written one run
@react-docgen/cli over their component files and feed the JSON output into their documentation generator.
- Tool authors who build documentation generators embed the
react-docgen library in packages/react-docgen/ instead of writing their own React component parser.
- Projects on the older 5.x line read the 5.x branch README to stay on the older extraction behaviour while newer projects follow react-docgen.dev.
- The project has 3,820 stars and 315 forks, which indicates adoption across a wide range of independent repositories rather than a single vendor-driven consumer.
Getting started
Install and run either @react-docgen/cli for command-line use or the react-docgen library for programmatic use; the CLI is a wrapper around that same library. Documentation for version 6.x and newer lives at react-docgen.dev, while version 5.x is documented in the README on the 5.x branch.
How it compares
No other tool is named in the facts provided, so this entry stands alone in this registry. Its distinguishing facts are its MIT License, its dual library-and-CLI shape, and its JSON output.
When to use it — and when not to
Choose it when a documentation generator needs component metadata and the project is already in the React and TypeScript toolchain. Do not choose it expecting finished documentation pages, since it produces structured data and nothing more, and check the TypeScript status first: the README points to issue #1005 rather than stating TypeScript support outright, and version 5.x is documented on a separate branch from the 6.x site, so version choice affects what the documentation covers.