building-components

Define accessible, composable UI components with Root/Item/Trigger/Content patterns for React-based projects.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/Happy-Horizon/cursor-marketplace --skill building-components-happy-horizon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: building-components
Source: https://github.com/Happy-Horizon/cursor-marketplace/tree/main/synced-vendor-skills/.agents/skills/building-components
Command: npx skills add https://github.com/Happy-Horizon/cursor-marketplace --skill building-components-happy-horizon

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

The Building Components skill provides a structured approach to designing, implementing, and documenting modern UI components that are accessible, composable, and easy to integrate into design systems.

Core Features & Use Cases

  • Guides the creation of UI primitives and compound components using well-defined Root/Item/Trigger/Content patterns.
  • Supplies best practices for accessibility, polymorphism, as-child composition, data-slot/state usage, and design-token based styling.
  • Documents naming conventions, component API structure, and DX-focused documentation patterns to improve consistency across projects.

Quick Start

Create a simple Accordion by composing Root, Item, Trigger, and Content from the library and verify keyboard navigation and ARIA attributes are correctly applied.

Frequently Asked Questions about building-components

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

FAQPage Schema
How do I build accessible UI components with proper keyboard navigation and ARIA attributes?

Build accessible UI components by composing structured Root, Item, Trigger, and Content primitives that automatically apply correct ARIA attributes and verify keyboard navigation. This enforces front-end accessibility standards across your React-based design system architecture.

What is the asChild pattern in React component composition and when should I use it?

The asChild pattern in React composition allows a component to pass its props to a child element without rendering an extra DOM node. Use it when you need polymorphic rendering behavior while maintaining accessibility and data-slot state management.

How do I structure a composable compound component API for a design system?

Structure composable compound component APIs by defining clear Root, Item, Trigger, and Content hierarchies. This enforces consistent naming conventions, supports polymorphism and as-child composition, and integrates data-slot and state patterns for Tailwind-based styling.

Does this component building approach work with Tailwind CSS styling and design tokens?

Yes, this component building approach works with Tailwind CSS by utilizing data-slot and state attributes to map design tokens directly into styling. It documents integration patterns ensuring composable primitives maintain consistent visual output across projects.

What's the best way to implement polymorphism in UI primitives without breaking accessibility?

Implement polymorphism in UI primitives by using the as-child composition pattern to pass through props while preserving ARIA attributes and keyboard event handling. This ensures accessible behavior remains intact when changing the underlying rendered element type.

Why does my compound component lose state or accessibility attributes when using polymorphism?

Compound components lose state or accessibility attributes during polymorphism when data-slot mapping or as-child prop forwarding is incorrectly configured. Enforce structured Root and Trigger API boundaries to ensure ARIA attributes and internal state sync correctly across composed elements.