What problem does it solve?
Modern frontend projects suffer from inconsistent component APIs, fragmented styling approaches, and accessibility regressions that make UI codebases hard to maintain and scale. This guide consolidates composition patterns, styling tradeoffs, and accessibility best practices to help teams build predictable, reusable components and design systems.
Core Features & Use Cases
- Composition patterns: compound components, render props, slots, and polymorphic components for flexible APIs and encapsulated state.
- Styling approaches: guidance on Tailwind, CSS Modules, styled-components, Emotion, and zero-runtime options like Vanilla Extract with tradeoffs for SSR and performance.
- Accessibility and UX: ARIA patterns, focus management, live regions, keyboard navigation, and contrast utilities to build accessible components by default.
- API design and patterns: prop naming, controlled vs uncontrolled inputs, forward refs, memoization, and strategies for refactoring legacy components.
- Performance and bundling: critical CSS extraction, code-splitting, and SSR considerations for production component libraries.
Quick Start
Use the web-component-design skill to draft a reusable, accessible React Button component that supports variants, sizes, and forwardRef.