Generate React CLI

11.0.4 · active · verified Wed Apr 22

generate-react-cli is a command-line interface tool designed to streamline the creation of React components, aiming to boost developer productivity by automating repetitive setup tasks. The current stable version is 11.0.4, released in April 2026. This package maintains a somewhat frequent release cadence, with multiple minor and patch releases occurring monthly or bi-monthly, and major versions typically updating Node.js requirements or tooling support. Its key differentiators include an initial interactive configuration that generates a `generate-react-cli.json` file, allowing project-specific defaults for TypeScript usage, CSS modules, various CSS preprocessors (like SCSS), and testing libraries (React Testing Library, Vitest, or no tests). It offers extensive customization through command-line options and support for custom component types, templates, and file structures, enabling developers to quickly scaffold components, pages, or layouts according to their project's conventions.

Common errors

Warnings

Install

Quickstart

Demonstrates how to generate a new React component using `npx`, prompting for initial configuration if run for the first time, and showing how to override default settings via command-line options.

npx generate-react-cli component Box

# The first command will prompt you to configure the CLI, creating a
# 'generate-react-cli.json' file. Then it generates a 'Box' component.

# Subsequent runs can override configured defaults using options:
npx generate-react-cli component Button --withTest=false --withStory=true

# For global installation (less recommended for CI/CD environments):
npm i -g generate-react-cli
generate-react component Navbar

view raw JSON →