component-patterns

Select and implement React component composition patterns with TypeScript code templates.

3|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/mauriciodelrio/delriodev-skills --skill component-patterns-mauriciodelrio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: component-patterns
Source: https://github.com/mauriciodelrio/delriodev-skills/tree/main/es-skills/software/frontend/component-patterns
Command: npx skills add https://github.com/mauriciodelrio/delriodev-skills --skill component-patterns-mauriciodelrio

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers often struggle to choose and correctly implement the right component composition pattern in React, leading to tangled code, poor reusability, and maintenance headaches.

Core Features & Use Cases

  • Provides a decision table to select the appropriate pattern for a given UI scenario.
  • Supplies ready‑to‑use TypeScript code templates for Compound Components, Render Props, Polymorphic components, Slot pattern, HOC, and controlled/uncontrolled components.
  • Guides on when to prefer composition, hooks, or higher‑order components, and highlights accessibility, testing, and performance considerations.
  • Ideal for building reusable UI elements such as tabs, accordions, forms, cards, and layout containers.

Quick Start

Ask the component-patterns skill to recommend the best pattern for creating a tabbed interface with controlled state.

Frequently Asked Questions about component-patterns

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

FAQPage Schema
What is the best React component pattern for building reusable tabs and accordions?

For reusable tabs and accordions, the Compound Components pattern is often recommended. It enables flexible UI composition while managing shared state internally, ensuring scalable architecture and adherence to accessibility best practices.

How do I choose between render props and higher-order components in React?

Choosing between render props and HOCs depends on your composition needs. A decision table helps select the right pattern by comparing type-safe TypeScript implementation requirements, performance impacts, and testing complexity for your specific scenario.

How to implement polymorphic components in TypeScript?

Implementing polymorphic components in TypeScript requires careful generic typing to ensure type safety across different HTML elements. Ready-to-use TypeScript code templates guide this process, allowing components to render as various elements while maintaining strict prop typing.

When should I use controlled versus uncontrolled components in React forms?

Controlled components are best when React needs to be the single source of truth for form state, while uncontrolled components rely on the DOM. A decision table guides selection based on your state management needs and testing requirements.

Does the slot pattern work well for React layout structures?

The Slot pattern works well for React layout structures by allowing parent components to inject content into specific child positions. It promotes highly reusable layout containers and type-safe TypeScript implementations without tightly coupling the layout to its content.

Why does component composition fail to meet accessibility standards?

Component composition fails accessibility standards when patterns like HOCs or render props obscure the DOM structure. Following guided accessibility considerations and testing best practices ensures reusable UI elements like accordions maintain proper ARIA roles and keyboard interactions.