create-component-react

Create reusable React components with TypeScript interfaces and clsx class merging.

5|Updated Apr 22, 2023
One-click install
npx skills add https://github.com/idealjs/camphora --skill create-component-react
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-component-react
Source: https://github.com/idealjs/camphora/tree/main/.roo/skills/2-%E5%88%9B%E5%BB%BA%E7%BB%84%E4%BB%B6
Command: npx skills add https://github.com/idealjs/camphora --skill create-component-react

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill codifies best practices for building reusable React components with typing, prop forwarding, and a clean export strategy, reducing boilerplate and ensuring consistency across projects.

Core Features & Use Cases

  • Stateless component blueprint with TypeScript interfaces prefixed by I<Component>Props
  • Prop forwarding to native elements (e.g., aria-*, onClick, disabled) through {...rest}
  • Class name merging with clsx to combine base component class with external class names
  • Centralized exports to simplify usage across packages
  • Use Case: A design-system team adds a new Button component and reuses it across dashboards without rewriting props handling.

Quick Start

Create a new component under packages/camphora-react/src/components, define the TS props interface, implement a functional component that forwards props, merge classes with clsx, and export it from packages/camphora-react/src/components/index.ts. Then ensure consumers can import via @idealjs/camphora-react.

Frequently Asked Questions about create-component-react

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create reusable React components with TypeScript prop forwarding?

To create reusable React components with TypeScript prop forwarding, define an I<Component>Props interface and spread native attributes via {...rest} to pass properties like aria-* or onClick directly to native elements.

What is the best way to merge custom and external class names in a React design system?

The best way to merge class names in a React design system is using the clsx utility, which combines base component classes with external class names passed through props without style conflicts.

How to export React components for reuse across multiple TypeScript packages?

To export React components for reuse across multiple TypeScript packages, centralize exports in an index.ts file, allowing consumers to import type-safe UI components consistently via package paths like @idealjs/camphora-react.

Can I use stateless functional components for a standardized React design system?

Yes, you can use stateless functional components for a standardized React design system. This approach fulfills requirements for TypeScript interfaces, native attribute passthrough, and clean exports without managing internal state.

Does this React component blueprint use TypeScript interfaces for props typing?

Yes, this React component blueprint uses TypeScript interfaces prefixed with I<Component>Props to enforce strict type safety and ensure standardized, predictable prop handling across the design system.

Why forward native HTML attributes to React components in a design system?

Forwarding native HTML attributes to React components in a design system allows developers to pass standard properties like disabled or aria-* directly through {...rest}, ensuring native element compatibility and accessibility without bespoke prop drilling.