All skills
Skillintermediate

Core Components

Use components from your core library instead of raw platform components. This ensures consistent styling and behavior.

Claude Code Knowledge Pack7/10/2026

Overview

Core Components

Design System Overview

Use components from your core library instead of raw platform components. This ensures consistent styling and behavior.

Design Tokens

NEVER hard-code values. Always use design tokens.

Spacing Tokens

// CORRECT - Use tokens

// WRONG - Hard-coded values

TokenValue
$14px
$28px
$312px
$416px
$624px
$832px

Color Tokens

// CORRECT - Semantic tokens

// WRONG - Hard-coded colors

Semantic TokenUse For
$textPrimaryMain text
$textSecondarySupporting text
$textTertiaryDisabled/hint text
$primary500Brand/accent color
$statusErrorError states
$statusSuccessSuccess states

Typography Tokens

TokenSize
$xs12px
$sm14px
$md16px
$lg18px
$xl20px
$2xl24px

Core Components

Box

Base layout component with token support:


  {children}

HStack / VStack

Horizontal and vertical flex layouts:


  
  Username

  Title
  Content

Text

Typography with token support:


  Hello World

Button

Interactive button with variants:


  Click Me

VariantUse For
solidPrimary actions
outlineSecondary actions
ghostTertiary/subtle actions
linkInline actions

Input

Form input with validation:

Card

Content container:


  
    Card Title
  
  
    Card content
  

Layout Patterns

Screen Layout

const MyScreen = () => (
  
    
    
      
    
  
);

Form Layout


  
  
  Submit

List Item Layout


  
  
    {title}
    {subtitle}
  
  

Anti-Patterns

// WRONG - Hard-coded values

// CORRECT - Design tokens

// WRONG - Raw platform components

// CORRECT - Core components

// WRONG - Inline styles

// CORRECT - Token props

Component Props Pattern

When creating components, use token-based props:

interface CardProps {
  padding?: '$2' | '$4' | '$6';
  variant?: 'elevated' | 'outlined' | 'filled';
  children: React.ReactNode;
}

const Card = ({ padding = '$4', variant = 'elevated', children }: CardProps) => (
  
    {children}
  
);

Integration with Other Skills

  • react-ui-patterns: Use core components for UI states
  • testing-patterns: Mock core components in tests
  • storybook: Document component variants