vercel-composition-patterns

Guide React component libraries toward explicit variants and compound components.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/birajdotdev/next-clerk-convex-starter --skill vercel-composition-patterns-birajdotdev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/birajdotdev/next-clerk-convex-starter/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/birajdotdev/next-clerk-convex-starter --skill vercel-composition-patterns-birajdotdev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

React projects often suffer from boolean prop proliferation and tangled conditional rendering. This guide promotes explicit variants and compound components, enabling scalable, readable component libraries.

Core Features & Use Cases

  • Explicit variant components (ThreadComposer, EditMessageComposer, ForwardMessageComposer) to replace complex prop nets.
  • Compound components with a shared context to avoid prop drilling across frames.
  • Generic context interfaces (state, actions, meta) to swap providers without touching UI.
  • React 19 API adaptations (use() instead of useContext, ref as a normal prop) to modernize patterns.

Quick Start

Wrap your UI in a provider, then compose the Frame with Input and Submit to start using the patterns.

Frequently Asked Questions about vercel-composition-patterns

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

FAQPage Schema
How do I refactor React components to avoid boolean prop proliferation?

Refactor React components by replacing boolean prop proliferation with explicit variant components and compound-component patterns. This approach untangles conditional rendering and rigid APIs to build scalable, readable component libraries.

What is the compound component pattern and how does it use shared context in React?

The compound component pattern uses a shared context to manage state across composed UI elements, avoiding prop drilling. It exposes a generic context interface containing state, actions, and meta to separate logic from presentation.

How do I apply React 19 APIs like use() to modernize context provider patterns?

Modernize context provider patterns by adopting React 19 APIs like the use() hook instead of useContext and passing ref as a normal prop. This updates provider-based state management for explicit variant components.

When should I use explicit variant components instead of multiple boolean props in React?

Use explicit variant components when a single component accumulates complex boolean prop nets. Creating separate variant components replaces tangled conditional rendering with readable, maintainable APIs for scalable UI patterns.

Can I swap context providers without touching the UI in a React component library?

Yes, you can swap providers without touching the UI by enforcing a generic context interface that exposes state, actions, and meta. This abstraction decouples provider implementation from the compound component rendering.

Does this React composition pattern work for building reusable APIs across multiple teams?

Yes, these composition patterns apply directly to building reusable APIs and designing scalable UI patterns across multiple projects and teams. Explicit variants and compound components ensure consistent, maintainable interfaces.