creating-styled-wrappers

Refactor styled compound components into wrappers using Base.Root and data-* attributes.

Updated Apr 26, 2026
One-click install
npx skills add https://github.com/awardsapp/tambo-genui --skill creating-styled-wrappers-awardsapp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: creating-styled-wrappers
Source: https://github.com/awardsapp/tambo-genui/tree/main/.claude/skills/creating-styled-wrappers
Command: npx skills add https://github.com/awardsapp/tambo-genui --skill creating-styled-wrappers-awardsapp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers refactor oversized styled components into smaller, maintainable wrappers by reusing tested base primitives instead of duplicating state, context, and event-handling logic.

Core Features & Use Cases

  • Eliminates duplicated logic by identifying where base already provides hooks, context, and handlers.
  • Builds styled wrapper components that compose Base.Root and styled sub-components instead of re-implementing internals.
  • Guides correct styling patterns using data-* attributes (including group-data-*) and reserving render props for behavior.
  • Supports refactoring workflows with an anti-pattern checklist and a verification step to prevent regressions.

Quick Start

Refactor your existing styled compound component to import the corresponding base component and wrap it with Base.Root, then move styling to the styled layer while leaving state and behavior to the base.

Frequently Asked Questions about creating-styled-wrappers

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

FAQPage Schema
How do I refactor styled React compound components to remove duplicated state and context?

Refactor styled React compound components by composing existing base primitives with Base.Root, moving styling to wrapper layers using data-* attributes while delegating state and context to the base architecture.

What is the best way to migrate styled components to a headless UI architecture?

Migrate styled components to headless UI by importing the correct Base namespace, wrapping elements with Base.Root for context, and applying visual styles via group-data-* selectors instead of duplicating internal logic.

When should I use render props versus data attributes for styling React wrappers?

Use data attributes and group-data-* selectors for visual styling in React wrappers, reserving render props strictly for modifying component behavior to ensure clean separation of concerns.

Can I use this refactoring approach for compound components with drag and drop or submission behavior?

Yes, this approach supports refactoring compound components like inputs, message composers, and toolbars that require state-based rendering alongside drag and drop or submission behavior without duplicating handlers.

How do I prevent regressions when refactoring UI components into styled wrappers?

Prevent regressions during UI refactoring by following an anti-pattern checklist and performing a verification step to ensure base primitives correctly provide required hooks, context, and event handlers.

Why does my styled wrapper still duplicate logic from the base component?

Styled wrappers duplicate logic when developers re-implement internal state, context, or event-handling instead of composing existing base primitives and using data-* attributes for visual styling.