Frontend design react

From matteocervelli/llms · View interactive version

Frontend design react is an AI agent skill from the GitHub repository matteocervelli/llms. Create distinctive, production-grade React/TypeScript frontends with exceptional design quality

How to use this skill

Skill file

Frontend Design React Skill

Create distinctive, production-grade React frontends with TypeScript and exceptional design quality. This skill integrates the 5-dimension design framework with React-specific patterns, Framer Motion animations, and accessibility best practices.

Base Aesthetics Framework

Overview

This is the core 5-dimension framework for creating intentional, non-generic design that avoids the homogenized aesthetic of default AI outputs. Each dimension works together to create designs with personality and deliberation.

The Five Dimensions

1. Typography Dimension

Purpose: Typography is the primary carrier of voice and personality in digital design.

Core Principles:

Implementation:

Example Pattern:

2. Color & Theme Dimension

Purpose: Color sets mood and creates visual coherence while avoiding cliché palettes.

Core Principles:

Anti-Patterns to Avoid:

Implementation:

Example Approach:

3. Motion Dimension

Purpose: Motion reveals personality and guides user attention with intentionality.

Core Principles:

Implementation:

Anti-Patterns:

4. Spatial Composition Dimension

Purpose: Space and layout create rhythm and guide the eye through intentional composition.

Core Principles:

Implementation:

Anti-Patterns:

5. Backgrounds & Visual Details Dimension

Purpose: The foundation layer that can transform a generic design into something memorable.

Core Principles:

Implementation:

Anti-Patterns:

Typography Guidance

Typefaces to Avoid

These fonts are ubiquitous in default AI outputs and should be rejected as your primary choice:

If you use any of these, pair them with something unexpected and deliberately break the generic pattern.

Typefaces to Prefer

These faces bring personality and intention to design:

Display & Decorative:

Body & Copy:

Monospace (Technical, Quotes, Code):

Pairing Strategy

High-Contrast Pairings (Recommended):

Pattern 1: Display + Mono

Headline: Playfair Display (elegant serif)
Body: JetBrains Mono (technical monospace)
Result: Sophisticated + Modern

Pattern 2: Serif + Geometric Sans

Headline: Crimson Pro (high-contrast serif)
Body: Space Grotesk (geometric sans)
Result: Elegant + Contemporary

Pattern 3: Decorative + Humanist

Headline: Bricolage Grotesque (handcrafted sans)
Body: IBM Plex Sans (warm humanist sans)
Result: Crafted + Approachable

Avoid Sameness

Don't use two similar typefaces:

Font Weights & Extremes

Use weight extremes to create contrast, not mid-range weights:

Good:

Avoid:

Size Jumps: Extreme Over Incremental

Use 3x+ jumps between hierarchy levels, not incremental 1.5x steps:

Generic (Linear Scaling):

H1: 48px
H2: 36px (75% of H1)
H3: 28px (78% of H2)
Body: 16px
Small: 14px

Result: Feels predictable, every size feels similar distance apart.

Intentional (3x+ Jumps):

Display: 96px (3x body)
Headline: 48px (3x body)
Sub-headline: 28px (1.75x body)
Body: 16px
Caption: 12px (0.75x body)

Result: Creates clear visual hierarchy, extreme sizes make smaller sizes feel intentional.

Implementation Rules:

  1. Start with body size (16px or 18px is standard)
  2. Create display size as 4-6x body (64px-96px)
  3. Create headline as 2-3x body (32px-48px)
  4. All other sizes fall between these extremes
  5. Use odd numbers when possible (not round 10px increments)

Example: 16px Base:

Line Height & Letter Spacing

Line Height Strategy:

Letter Spacing Strategy:

CSS-in-JS Implementation (Styled Components)

import styled from 'styled-components';

export const TypographyTokens = {
  display: {
    fontSize: '88px',
    fontFamily: "'Playfair Display', serif",
    fontWeight: 700,
    lineHeight: 1.1,
    letterSpacing: '-0.5px',
  },
  h1: {
    fontSize: '48px',
    fontFamily: "'Playfair Display', serif",
    fontWeight: 700,
    lineHeight: 1.2,
    letterSpacing: '-0.25px',
  },
  body: {
    fontSize: '16px',
    fontFamily: "'IBM Plex Sans', sans-serif",
    fontWeight: 400,
    lineHeight: 1.6,
    letterSpacing: 0,
  },
  mono: {
    fontSize: '14px',
    fontFamily: "'JetBrains Mono', monospace",
    fontWeight: 400,
    lineHeight: 1.5,
    letterSpacing: '0.5px',
  },
  caption: {
    fontSize: '12px',
    fontFamily: "'IBM Plex Sans', sans-serif",
    fontWeight: 400,
    lineHeight: 1.7,
    letterSpacing: 0,
  },
};

export const Display = styled.h1`
  ${Object.entries(TypographyTokens.display)
    .map(([key, value]) => `${key}: ${value};`)
    .join('\n')}
`;

export const Heading = styled.h2`
  ${Object.entries(TypographyTokens.h1)
    .map(([key, value]) => `${key}: ${value};`)
    .join('\n')}
`;

export const Body = styled.p`
  ${Object.entries(TypographyTokens.body)
    .map(([key, value]) => `${key}: ${value};`)
    .join('\n')}
`;

Font Loading (Google Fonts in React)

// In your main App.tsx or _document.tsx
import { useEffect } from 'react';

export function FontLoader() {
  useEffect(() => {
    const link = document.createElement('link');
    link.href = 'https://fonts.googleapis.com/css2?family=Playfair+Display:wght@300;400;700&family=IBM+Plex+Sans:wght@400;600&family=JetBrains+Mono:wght@400;500&display=swap';
    link.rel = 'stylesheet';
    document.head.appendChild(link);
  }, []);

  return null;
}

Typography Checklist

Motion & Animation Guidance (React/Framer Motion)

Overview

Motion reveals personality and guides user attention with intentionality. Deliberate animation transforms passive interfaces into experiences that feel alive and considered.

Core Principles

  1. Orchestration: Animations should feel planned, not random
  2. Purpose: Every animation should serve a functional or emotional purpose
  3. Timing: Easing functions matter more than duration
  4. Context: Page loads, scrolls, and hovers each have different animation strategies

React/Framer Motion Animations

Use Framer Motion for state-driven animations and complex sequences:

Basic Animation:

import { motion } from 'framer-motion';

export function AnimatedCard() {
  return (
    <motion.div
      initial={{ opacity: 0, y: 20 }}
      animate={{ opacity: 1, y: 0 }}
      transition={{
        duration: 0.6,
        ease: "easeOut"
      }}
    >
      Card content
    </motion.div>
  );
}

Staggered Children Animation:

import { motion } from 'framer-motion';

const containerVariants = {
  hidden: { opacity: 0 },
  visible: {
    opacity: 1,
    transition: {
      staggerChildren: 0.1,
    },
  },
};

const childVariants = {
  hidden: { opacity: 0, y: 20 },
  visible: {
    opacity: 1,
    y: 0,
    transition: { duration: 0.6, ease: "easeOut" },
  },
};

export function AnimatedList({ items }: { items: Array<any> }) {
  return (
    <motion.div
      variants={containerVariants}
      initial="hidden"
      animate="visible"
    >
      {items.map((item) => (
        <motion.div key={item.id} variants={childVariants}>
          {item.content}
        </motion.div>
      ))}
    </motion.div>
  );
}

Page Load Animation Strategy

Orchestrated Reveal:

Don't animate everything at once. Create a sequence that guides the user's eye:

import { motion } from 'framer-motion';

export function PageLoad() {
  const containerVariants = {
    hidden: { opacity: 0 },
    visible: {
      opacity: 1,
      transition: { staggerChildren: 0.1, delayChildren: 0.2 },
    },
  };

  return (
    <>
      <motion.div
        className="hero"
        initial={{ opacity: 0 }}
        animate={{ opacity: 1 }}
        transition={{ duration: 0.8 }}
      />
      <motion.h1
        initial={{ opacity: 0, y: -20 }}
        animate={{ opacity: 1, y: 0 }}
        transition={{ duration: 0.8, delay: 0.2, ease: "easeOut" }}
      >
        Headline
      </motion.h1>
      <motion.div
        className="content"
        variants={containerVariants}
        initial="hidden"
        animate="visible"
      >
        {/* Content items */}
      </motion.div>
    </>
  );
}

Timing Sequence:

0ms    - Background/Hero fades in
200ms  - Headline slides in from top
400ms  - Sub-headline fades in
600ms  - Primary CTA appears
800ms  - Supporting content staggered reveal

Scroll Trigger Animations

Using Framer Motion with scroll events:

import { motion } from 'framer-motion';
import { useInView } from 'react-intersection-observer';

export function ScrollReveal({ children }: { children: React.ReactNode }) {
  const { ref, inView } = useInView({ threshold: 0.1 });

  return (
    <motion.div
      ref={ref}
      initial={{ opacity: 0, y: 40 }}
      animate={inView ? { opacity: 1, y: 0 } : { opacity: 0, y: 40 }}
      transition={{ duration: 0.8, ease: "easeOut" }}
    >
      {children}
    </motion.div>
  );
}

Hover State Surprises

Hover interactions should be delightful, not just functional:

export function HoverCard() {
  return (
    <motion.div
      whileHover={{
        y: -8,
        boxShadow: '0 24px 48px rgba(0,0,0,0.2)',
      }}
      transition={{ duration: 0.3, ease: "easeOut" }}
    >
      <motion.span
        whileHover={{ rotate: 45, scale: 1.1 }}
        transition={{ duration: 0.2 }}
      >
        🎯
      </motion.span>
    </motion.div>
  );
}

Easing Functions

Recommended Easing Values:

Motion Checklist

Anti-Patterns: What to Avoid

Typography Anti-Patterns

Generic Font Choices - Avoid Inter, Roboto, Open Sans, Lato, system fonts. Result: Immediately reads as "default AI design," no personality.

Incremental Size Jumps - Avoid H1: 48px, H2: 40px, H3: 32px. Better: Display: 88px, Headline: 48px, Sub: 28px, Body: 16px.

Mid-Range Font Weights Only - Avoid using only weights 400, 500, 600. Better: Display: 300 or 700, Body: 400, Emphasis: 800/900.

Color & Theme Anti-Patterns

Cliché Color Schemes - Avoid Material Design Trinity (Blue, Red, Green), default SaaS blues, rainbow palettes, pure grays.

Monochrome Everything - Avoid: Background: #f5f5f5, Text: #333333, Accent: #0099ff. Result: Feels corporate and soulless.

Oversaturated Accent Colors - Avoid neon colors at 100% saturation that don't exist in real life.

Layout & Spatial Anti-Patterns

Cookie-Cutter Centered Layout - Avoid: Everything centered, symmetrical, predictable grid alignment. Reads as: "Default SaaS dashboard"

Uniform Padding Everywhere - Avoid: Same padding on all elements, no variation in spacing, everything feels equally distant.

Motion & Animation Anti-Patterns

Linear Timing on Everything - Avoid: transition: all 0.3s linear; - Feels robotic.

No Animation at All - Avoid: Instant page loads, no hover feedback, transitions that snap instantly.

Animation-Heavy Design - Avoid: Animating every element, multiple simultaneous animations, animation that distracts from content.

Slow, Sluggish Motion - Avoid: transition: all 2s linear; - Feels like the app is struggling to load.

Design Thinking: Pre-Coding Workflow

The Pre-Design Checklist

Don't design until you answer these four questions:

  1. Purpose: What problem are we solving? Who are we solving it for?
  2. Tone: What emotional response do we want? What aesthetic direction reflects this?
  3. Constraints: What are the real technical, temporal, or business limits?
  4. Differentiation: What one unforgettable element makes this distinctly ours?

1. Purpose: Problem & Users

Questions to Answer:

2. Tone: Aesthetic Direction

Based on your purpose, what emotional response should the design evoke?

Emotional Directions:

3. Constraints: Reality Check

Before designing, know your boundaries:

Categories:

4. Differentiation: The Unforgettable Element

Every intentional design has one element that makes it memorable and distinctly yours.

Types of Differentiation:

  1. Typography Signature - A distinctive typeface pairing, unusual size/weight hierarchy
  2. Color Signature - An unexpected color choice in an expected place
  3. Motion Signature - A particular animation pattern no one else uses
  4. Layout/Composition Signature - An unusual spatial arrangement
  5. Micro-interaction Signature - A delight that appears on interaction
  6. Visual Detail Signature - Illustration style, pattern, or specific visual treatment

Anti-Pattern: Designing Without Foundation

What NOT to do:

"Let's make an app. Use modern design. Blue accent color.
Put a card here, buttons there. Done."

What TO do instead:

"This app is for busy professionals who are skeptical of new tools.
We want them to feel calm confidence. We'll differentiate with
warm serif typography and burnt orange accents. Motion will be
snappy and encouraging. The unforgettable element is the delight
of task completion with orchestrated motion."

Checklist: Are You Ready to Design?

Workflow Steps: 8-Phase Design Process for React

Phase 1: Design Thinking

Complete the pre-design checklist. Answer: Purpose, Tone, Constraints, Differentiation. No code yet.

Phase 2: Typography Dimension

Phase 3: Color & Theme Dimension

Phase 4: Motion Dimension

Phase 5: Spatial Composition Dimension

Phase 6: Backgrounds & Visual Details Dimension

Phase 7: Implementation (React Components)

Phase 8: Validation

React-Specific Best Practices

TypeScript Component Structure

interface CardProps {
  title: string;
  description: string;
  onInteract?: () => void;
  variant?: 'primary' | 'secondary';
}

export const Card: React.FC<CardProps> = React.memo(({
  title,
  description,
  onInteract,
  variant = 'primary'
}) => {
  return (
    <motion.div
      initial={{ opacity: 0, y: 20 }}
      animate={{ opacity: 1, y: 0 }}
      whileHover={{ y: -4 }}
      className={`card card--${variant}`}
    >
      <h3>{title}</h3>
      <p>{description}</p>
    </motion.div>
  );
});

Card.displayName = 'Card';

Accessibility in React

export const InteractiveButton: React.FC<{
  label: string;
  onClick: () => void;
  disabled?: boolean;
  ariaLabel?: string;
}> = ({ label, onClick, disabled, ariaLabel }) => {
  return (
    <motion.button
      onClick={onClick}
      disabled={disabled}
      aria-label={ariaLabel || label}
      role="button"
      whileHover={{ scale: 1.05 }}
      whileTap={{ scale: 0.95 }}
    >
      {label}
    </motion.button>
  );
};

Performance Optimization

// Use React.memo to prevent unnecessary re-renders
export const OptimizedComponent = React.memo(({ data }: Props) => {
  return <div>{data}</div>;
});

// Use useCallback for stable function references
const handleClick = useCallback(() => {
  // Handle click
}, []);

// Use useMemo for expensive computations
const processedData = useMemo(() => {
  return expensiveOperation(data);
}, [data]);

Mobile-First Responsive Design

import styled from 'styled-components';

export const ResponsiveContainer = styled.div`
  /* Mobile-first */
  padding: 16px;
  font-size: 14px;

  /* Tablet */
  @media (min-width: 768px) {
    padding: 24px;
    font-size: 16px;
  }

  /* Desktop */
  @media (min-width: 1024px) {
    padding: 32px;
    font-size: 18px;
  }
`;

Anti-Generic-AI Checklist (React Edition)

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.