Color Theory, Typography, UI/UX Principles, Layout, Figma Shortcuts, Canva, Iconography, Design Handoff — complete creative reference.
Color theory is the backbone of visual design. Understanding how colors relate, contrast, and communicate helps you create harmonious, accessible, and brand-consistent interfaces.
| Category | Colors | Description |
|---|---|---|
| Primary | Red, Yellow, Blue | Cannot be created by mixing other colors |
| Secondary | Orange, Green, Purple | Mixing two primary colors |
| Tertiary | Red-Orange, Yellow-Green, etc. | Mixing a primary with an adjacent secondary |
| Warm | Red, Orange, Yellow, variants | Energetic, passionate, attention-grabbing |
| Cool | Blue, Green, Purple, variants | Calm, professional, trustworthy |
| Neutral | White, Black, Gray, Brown | Balancing and grounding palette elements |
| Harmony | Rule | Mood |
|---|---|---|
| Complementary | Opposite on wheel (180 degrees) | High contrast, vibrant |
| Analogous | 3 adjacent colors (30 degrees) | Cohesive, serene |
| Triadic | 3 equidistant (120 degrees) | Balanced, colorful |
| Split-Comp. | Base + 2 adjacent to complement | Rich, less tension |
| Tetradic | 2 complementary pairs (rectangle) | Complex, playful |
| Monochromatic | Single hue, varied lightness | Clean, elegant |
| Color | Hex | Positive Associations | Common Usage |
|---|---|---|---|
| Red | #E53E3E | Passion, urgency, energy, love | CTAs, sale tags, errors, food brands |
| Orange | #ED8936 | Enthusiasm, creativity, warmth | CTAs, playful brands, autumn themes |
| Yellow | #ECC94B | Happiness, optimism, clarity | Warnings, highlights, children brands |
| Green | #38A169 | Growth, health, prosperity, nature | Success, eco brands, finance, wellness |
| Blue | #3182CE | Trust, stability, professionalism | Tech, banking, healthcare, social media |
| Purple | #805AD5 | Luxury, wisdom, spirituality | Premium brands, beauty, meditation apps |
| Pink | #ED64A6 | Romance, femininity, playfulness | Fashion, beauty, dating apps |
| Brown | #8B6F47 | Reliability, earthiness, comfort | Coffee, organic, rustic brands |
| Black | #1A202C | Power, elegance, sophistication | Luxury, fashion, editorial |
| White | #FFFFFF | Purity, simplicity, cleanliness | Healthcare, minimal design, space |
| Gray | #718096 | Neutrality, balance, professionalism | Backgrounds, text, UI chrome |
| Teal | #319795 | Sophistication, clarity, uniqueness | Startups, creative agencies, tech |
| Level | Normal Text | Large Text (18px+) | UI Components |
|---|---|---|---|
| AA (minimum) | 4.5 : 1 | 3.0 : 1 | 3.0 : 1 |
| AAA (enhanced) | 7.0 : 1 | 4.5 : 1 | Not required |
/* ── Design Token Pattern for Colors ── */
:root {
/* Primary palette */
--color-primary-50: #eff6ff;
--color-primary-100: #dbeafe;
--color-primary-500: #3b82f6;
--color-primary-700: #1d4ed8;
--color-primary-900: #1e3a5f;
/* Semantic tokens */
--color-bg: #0f172a;
--color-surface: #1e293b;
--color-border: #334155;
--color-text: #f1f5f9;
--color-text-muted: #94a3b8;
/* Feedback */
--color-success: #22c55e;
--color-warning: #f59e0b;
--color-error: #ef4444;
--color-info: #3b82f6;
}| Brand | Primary | Secondary | Accent |
|---|---|---|---|
| Spotify | #1DB954 | #191414 | #B3B3B3 |
| Slack | #4A154B | #2EB67D | #ECB22E |
| Stripe | #635BFF | #00D4FF | #FF6B6B |
| Notion | #000000 | #FFFFFF | #FF6B6B |
| Figma | #F24E1E | #A259FF | #0ACF83 |
| Linear | #5E6AD2 | #2D3047 | #FF3D71 |
| Vercel | #000000 | #FFFFFF | #0070F3 |
| GitHub | #181717 | #58A6FF | #238636 |
#999) on white backgrounds — it fails WCAG AA.Typography is 95% of web design. Good type hierarchy, spacing, and pairing can make or break readability and brand perception.
| Type | Characteristics | Use Case |
|---|---|---|
| Serif | Feet on letter ends, traditional | Print, editorial, luxury brands |
| Sans-Serif | Clean, no feet, modern | Web, apps, tech brands |
| Monospace | Fixed width, technical | Code, terminal, data tables |
| Display | Decorative, attention-grabbing | Hero headings, logos, posters |
| Handwriting | Script, personal feel | Quotes, invitations, accents |
| Rule | Example Pairing |
|---|---|
| Contrast categories | Serif heading + Sans-serif body |
| Match x-height | Inter + Merriweather (similar proportions) |
| Same designer | EB Garamond + EB Garamond italic |
| Limit to 2-3 fonts | Heading + body + monospace max |
| Match mood | Playfair Display + Source Sans Pro (editorial) |
| Style | Heading Font | Body Font | Best For |
|---|---|---|---|
| Modern SaaS | Inter | Inter | Dashboards, apps, docs |
| Editorial | Playfair Display | Source Sans 3 | Blogs, magazines, media |
| Minimal | Space Grotesk | DM Sans | Startups, portfolios |
| Creative | Syne | Work Sans | Agencies, design studios |
| Technical | JetBrains Mono | Inter | Dev tools, code editors |
| Warm / Friendly | Nunito | Open Sans | Social, community, education |
| Luxury | Cormorant Garamond | Proza Libre | Fashion, hospitality |
| Bold / Startup | Clash Display | Satoshi | Landing pages, pitch decks |
| Element | Desktop Size | Mobile Size | Weight | Line Height |
|---|---|---|---|---|
| H1 / Display | 48-64px (3-4rem) | 32-40px (2-2.5rem) | 700-800 | 1.1-1.2 |
| H2 | 32-40px (2-2.5rem) | 24-32px (1.5-2rem) | 700 | 1.2-1.3 |
| H3 | 24-28px (1.5-1.75rem) | 20-24px (1.25-1.5rem) | 600-700 | 1.3 |
| H4 | 20-24px (1.25-1.5rem) | 18-20px (1.125-1.25rem) | 600 | 1.4 |
| H5 | 18px (1.125rem) | 16px (1rem) | 600 | 1.4 |
| H6 | 16px (1rem) | 14px (0.875rem) | 600-700 | 1.5 |
| Body Large | 18px (1.125rem) | 16px (1rem) | 400 | 1.6-1.7 |
| Body | 16px (1rem) | 14-16px | 400 | 1.5-1.6 |
| Body Small | 14px (0.875rem) | 13px | 400 | 1.5 |
| Caption / Label | 12px (0.75rem) | 11-12px | 500 | 1.4 |
/* ── Responsive Fluid Typography with clamp() ── */
:root {
/* Fluid type scale based on 1rem = 16px */
--font-display: clamp(2rem, 5vw, 4rem); /* 32-64px */
--font-h2: clamp(1.5rem, 3.5vw, 2.5rem); /* 24-40px */
--font-h3: clamp(1.25rem, 2.5vw, 1.75rem); /* 20-28px */
--font-body: clamp(1rem, 1.2vw, 1.125rem); /* 16-18px */
--font-small: clamp(0.8rem, 1vw, 0.875rem); /* 13-14px */
--font-caption: clamp(0.7rem, 0.8vw, 0.75rem); /* 11-12px */
}
/* Line height & letter spacing best practices */
h1, h2 { line-height: 1.15; letter-spacing: -0.02em; }
h3, h4 { line-height: 1.3; letter-spacing: -0.01em; }
body { line-height: 1.6; letter-spacing: 0; }
small, caption {
line-height: 1.4;
letter-spacing: 0.02em;
text-transform: uppercase;
}| Context | Line Height | Letter Spacing |
|---|---|---|
| Headings | 1.1 - 1.3 | -0.02em to -0.01em |
| Body text | 1.5 - 1.7 | 0 (default) |
| Small text | 1.4 - 1.5 | 0.01em - 0.03em |
| ALL CAPS / Labels | 1.3 - 1.4 | 0.05em - 0.1em |
| Dense data tables | 1.3 | 0 |
| Wide tracking (display) | 1.1 | 0.05em - 0.2em |
| Mistake | Solution |
|---|---|
| Body text below 14px | Minimum 16px for readability |
| Pure black on white | Use #1a1a1a or #222 for softer contrast |
| Too many font families | Stick to 2 fonts maximum |
| Justified text on web | Use left-align for digital reading |
| No paragraph spacing | Use margin-bottom = line height |
| All caps for body text | Reserve ALL CAPS for labels only |
| Ignoring vertical rhythm | Use 4px/8px spacing grid |
| Low contrast text | Maintain WCAG AA 4.5:1 ratio |
clamp() for responsive typography instead of multiple media queries. The pattern clamp(min, preferred, max) smoothly scales text between breakpoints without jump cuts.Good UI/UX is invisible. Users should accomplish goals effortlessly. These principles from Nielsen, Gestalt psychology, and interaction design form the foundation of usable products.
| # | Heuristic | Key Question |
|---|---|---|
| 1 | Visibility of system status | Does the user know what is happening? |
| 2 | Match real world | Does it use familiar language and concepts? |
| 3 | User control & freedom | Can users undo/redo actions easily? |
| 4 | Consistency & standards | Are patterns consistent across the product? |
| 5 | Error prevention | Are mistakes prevented before they occur? |
| 6 | Recognition over recall | Can users recognize options vs memorize? |
| 7 | Flexibility & efficiency | Are there shortcuts for power users? |
| 8 | Aesthetic & minimalist | Is every element serving a purpose? |
| 9 | Error recovery | Are errors clear, specific, and fixable? |
| 10 | Help & documentation | Can users find help when stuck? |
| Law | Principle | Application |
|---|---|---|
| Fitts Law | Larger + closer = faster | Make CTAs big and within thumb reach |
| Hick Law | More choices = slower | Limit nav items to 5-7 max |
| Miller Law | 7 +/- 2 items in memory | Chunk info into groups of 5-9 |
| Jakob Law | Users expect patterns | Follow conventions (logo top-left) |
| Von Restorff | Distinct = memorable | Make key actions visually unique |
| Tesler Law | Complexity is conserved | Push complexity to system, not user |
| Parkinson Law | Work expands to fill time | Set default deadlines in forms |
| Principle | Description | UI Example |
|---|---|---|
| Proximity | Nearby items are grouped | Form field labels near inputs |
| Similarity | Similar items are grouped | Consistent icon style in toolbar |
| Continuity | Eye follows paths/lines | Horizontal card layout flow |
| Closure | Brain completes shapes | Circular crop on avatars |
| Figure/Ground | Focus vs background | Modal dialogs with overlays |
| Common Region | Borders group items | Card components with borders |
| Symmetry | Balanced = stable | Centered hero sections |
| Area | Requirement | How to Test |
|---|---|---|
| Color | Contrast ratio 4.5:1 (AA) | DevTools contrast checker |
| Keyboard | All interactive elements focusable | Tab through entire page |
| Screen Reader | Meaningful alt text on images | Use VoiceOver / NVDA |
| Focus | Visible focus indicators | Check :focus-visible styles |
| Text | Resizable up to 200% | Ctrl+/ zoom in browser |
| Motion | Respect prefers-reduced-motion | Media query check |
| Forms | Labels linked to inputs | Click label focuses input |
| Links | Descriptive link text | No click here / read more |
| Headings | Logical H1-H6 hierarchy | Screen reader heading nav |
| ARIA | Use semantic HTML first | Add ARIA only when needed |
| Tip | Detail |
|---|---|
| Touch targets 44x44px+ | Apple HIG minimum tap target |
| Thumb zone awareness | Primary actions in bottom half |
| Simplify navigation | Bottom tab bar over hamburger menu |
| Minimize form fields | Use autofill, default values, step forms |
| Avoid horizontal scroll | Content should flow vertically |
| Test on real devices | Emulators miss performance issues |
| Rule | Guideline |
|---|---|
| Do not use pure black | Use #121212 or #0f172a as base |
| Lower elevation = darker | Surface hierarchy through lightness |
| Desaturate colors | Reduce color intensity by 10-20% |
| Avoid heavy shadows | Use subtle borders or light elevation |
| Test contrast for muted | Secondary text needs extra contrast |
| Respect user preference | Use prefers-color-scheme media query |
Consistent spacing, grids, and layout patterns create visual harmony and make development faster. Every design system starts with a spacing scale and grid.
| Name | Width | Columns | Gutter | Common Devices |
|---|---|---|---|---|
| Mobile S | 320px | 4 | 16px | iPhone SE |
| Mobile M | 375px | 4 | 16px | iPhone 12/13/14 |
| Mobile L | 428px | 4 | 16px | iPhone 14 Pro Max |
| Tablet | 768px | 8 | 24px | iPad, Galaxy Tab |
| Laptop | 1024px | 12 | 24px | Small laptops |
| Desktop | 1280px | 12 | 24px | Standard screens |
| Wide | 1536px | 12 | 32px | Large monitors |
| Ultra | 1920px | 12 | 32-48px | Full HD+ displays |
| Feature | Flexbox | CSS Grid |
|---|---|---|
| Dimension | 1D (row OR column) | 2D (rows AND columns) |
| Layout type | Content-driven flow | Container-driven layout |
| Alignment | Main + cross axis | Rows, columns, areas |
| Best for | Nav bars, toolbars, cards | Page layouts, dashboards |
| Gap support | Yes (gap shorthand) | Yes (row-gap, column-gap) |
| Responsive | flex-wrap for reflow | auto-fit / auto-fill + minmax |
| Learning curve | Moderate | Moderate-High |
| Browser support | 97%+ | 96%+ |
/* ── Flexbox vs Grid: When to Use Which ── */
/* Flexbox: Navbar / Toolbar */
.navbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 0 24px;
height: 64px;
}
/* Grid: Dashboard Layout */
.dashboard {
display: grid;
grid-template-columns: 260px 1fr 300px;
grid-template-rows: 64px 1fr;
grid-template-areas:
"sidebar header header"
"sidebar main aside";
min-height: 100vh;
}
/* Grid: Auto-responsive card grid */
.card-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 24px;
}
/* Grid: Holy Grail Layout */
.page {
display: grid;
grid-template: auto 1fr auto / 200px 1fr 200px;
grid-template-areas:
"header header header"
"nav main aside"
"footer footer footer";
min-height: 100vh;
}| Pattern | Structure | Best For |
|---|---|---|
| Sidebar + Content | Fixed sidebar + scrollable main | Dashboards, docs, admin panels |
| Dashboard Grid | Stats row + 2-3 column cards | Analytics, CRM, project mgmt |
| Hero Section | Full-width centered CTA | Landing pages, marketing sites |
| Card Grid | Auto-fill responsive cards | Product listings, portfolios |
| Bento Grid | Mixed-size cards in grid | Feature showcases, Apple-style |
| Z-Pattern | Top-left to bottom-right flow | Simple pages, landing pages |
| F-Pattern | Top horizontal then left vertical | Text-heavy, blog, news sites |
Mastering Figma shortcuts dramatically speeds up your workflow. These 50+ shortcuts cover the most common design, selection, and editing operations.
| Shortcut | Action |
|---|---|
| Ctrl + / | Search commands / shortcuts menu |
| Ctrl + Z | Undo |
| Ctrl + Shift + Z | Redo |
| Ctrl + S | Save (auto-saves, also forces sync) |
| Ctrl + Shift + E | Export selected frame |
| Ctrl + G | Group selection |
| Ctrl + Shift + G | Ungroup |
| Ctrl + D | Duplicate |
| Ctrl + Alt + G | Toggle frame vs group |
| Ctrl + P | Show plugins panel |
| Ctrl + \ | Toggle left panel |
| Ctrl + ] | Toggle right panel |
| Shortcut | Action |
|---|---|
| V | Move tool |
| F | Frame tool |
| R | Rectangle tool |
| O | Ellipse tool |
| L | Line tool |
| T | Text tool |
| P | Pen tool |
| H | Hand (pan) tool |
| Z | Zoom tool (drag to zoom) |
| Ctrl + A | Select all in frame |
| Ctrl + Alt + A | Select all on canvas |
| Space + drag | Pan canvas |
| Ctrl + 1-4 | Zoom to 100%, 200%, fit, selection |
| Shortcut | Action |
|---|---|
| Ctrl + C / V | Copy / Paste |
| Ctrl + Shift + V | Paste over selection (in place) |
| Shift + drag | Constrain proportions |
| Alt + drag | Duplicate on drag |
| Ctrl + Drag handle | Resize from center |
| Shift + resize | Maintain aspect ratio |
| Ctrl + Shift + Drag | Copy + resize from center |
| Ctrl + [ / ] | Bring forward / send backward |
| Ctrl + Alt + [ / ] | Bring to front / send to back |
| Ctrl + Alt + B | Boolean operations menu |
| Ctrl + E | Flatten / union selection |
| Ctrl + Shift + X | Flip horizontal |
| Ctrl + Shift + Y | Flip vertical |
| Shortcut | Action |
|---|---|
| Ctrl + B | Bold |
| Ctrl + I | Italic |
| Ctrl + U | Underline |
| Ctrl + Shift + L | Align left |
| Ctrl + Shift + C | Align center (horiz.) |
| Ctrl + Shift + R | Align right |
| Ctrl + Shift + T | Align top |
| Ctrl + Shift + M | Align middle (vert.) |
| Ctrl + Shift + B | Align bottom |
| Ctrl + Alt + H | Distribute horizontally |
| Ctrl + Alt + V | Distribute vertically |
| Shift + H | Toggle text auto-wrap |
| Shortcut | Action |
|---|---|
| Ctrl + Alt + K | Create / update component |
| Ctrl + Alt + B | Create / update component set |
| Ctrl + Alt + O | Override component instance |
| Alt + click instance | Reset instance override |
| Shift + A | Add auto layout to selection |
| Ctrl + Alt + A | Toggle auto layout direction |
| Ctrl + Alt + L / R | Switch horizontal / vertical layout |
| Space between items | Use gap property instead of spacer |
| Alt + click + drag | Nest frame inside parent (auto layout) |
| Ctrl + Alt + F | Fill container (auto layout) |
| Shortcut | Action |
|---|---|
| Ctrl + Alt + P | Open prototype panel |
| Enter / Shift + Enter | Play / stop prototype |
| Ctrl + ; | Add comment |
| Ctrl + Alt + ; | View all comments |
| Ctrl + Shift + M | Switch to branch / main |
| Ctrl + Alt + S | Share link |
| Ctrl + E | Open export panel |
| Ctrl + Alt + R | Record a flow |
| Ctrl + Alt + W | View component documentation |
| Ctrl + Shift + F | Toggle design / dev mode |
Ctrl + / anytime to open the command palette. You can search for any action, plugin, or setting. This single shortcut eliminates the need to memorize most menu paths.Choosing the right tool for the job saves time and produces better results. Here is a comparison of the most popular design tools, image formats, and social media specs.
| Feature | Figma | Canva | Photoshop | Illustrator |
|---|---|---|---|---|
| Best For | UI/UX, prototypes | Social media, presentations | Photo editing, composites | Vector graphics, logos |
| Platform | Web, Desktop, Mobile | Web, Desktop, Mobile | Desktop | Desktop, iPad |
| Collaboration | Real-time multiplayer | Real-time, sharing | Limited (Cloud docs) | Limited |
| Learning Curve | Moderate | Easy | Steep | Steep |
| Pricing | Free + $15/mo | Free + $13/mo | $23/mo | Free + $23/mo |
| Vector Editing | Yes (limited) | Yes (limited) | Yes (limited) | Full |
| Raster Editing | No | Basic | Full | No |
| Prototyping | Interactive | None | None | None |
| Components | Yes | Templates | Smart objects | Symbols |
| Plugins | Rich ecosystem | Built-in apps | Rich ecosystem | Limited |
| Format | Type | Transparency | Best Use | Compression |
|---|---|---|---|---|
| PNG | Raster | Yes (alpha) | Logos, screenshots, icons | Lossless |
| JPG / JPEG | Raster | No | Photos, complex images | Lossy |
| SVG | Vector | Yes | Icons, logos, illustrations | Text (XML) |
| WebP | Both | Yes | Modern web images | Lossy / Lossless |
| AVIF | Both | Yes | Next-gen web (50% smaller) | Lossy / Lossless |
| GIF | Raster | Yes (binary) | Simple animations, memes | Lossless (256 colors) |
| ICO | Raster | Yes | Favicon, app icons | Lossless |
| Lottie | Vector (JSON) | Yes | UI animations (web/mobile) | Text (JSON) |
| Platform | Placement | Size (px) | Aspect Ratio |
|---|---|---|---|
| Post (square) | 1080 x 1080 | 1:1 | |
| Post (portrait) | 1080 x 1350 | 4:5 | |
| Post (landscape) | 1080 x 566 | 1.91:1 | |
| Story / Reel | 1080 x 1920 | 9:16 | |
| Profile photo | 320 x 320 (display 110) | 1:1 | |
| Post image | 1200 x 630 | 1.91:1 | |
| Cover photo | 820 x 312 | 2.63:1 | |
| Story | 1080 x 1920 | 9:16 | |
| Ad image | 1200 x 628 | 1.91:1 | |
| X / Twitter | Post image | 1600 x 900 | 16:9 |
| X / Twitter | Header | 1500 x 500 | 3:1 |
| Post image | 1200 x 627 | 1.91:1 | |
| Banner | 1584 x 396 | 4:1 | |
| Profile photo | 400 x 400 | 1:1 | |
| YouTube | Thumbnail | 1280 x 720 | 16:9 |
| YouTube | Channel banner | 2560 x 1440 | 16:9 |
| YouTube | Video (HD) | 1920 x 1080 | 16:9 |
| YouTube | Shorts | 1080 x 1920 | 9:16 |
| Pin | 1000 x 1500 | 2:3 | |
| TikTok | Video | 1080 x 1920 | 9:16 |
| Platform / Use | Resolution | DPI / PPI |
|---|---|---|
| Web (standard) | 72-96 PPI | 72 DPI (screens) |
| Retina / HiDPI | 144-192 PPI | 2x image assets |
| Print (magazine) | 300 PPI | 300 DPI |
| Print (billboard) | 72-150 PPI | Viewed from distance |
| Social media | 72 PPI | Optimized for web |
| App icons (iOS) | 1024 x 1024 source | Auto-generated sizes |
| App icons (Android) | 512 x 512 source | Adaptive icon 108dp |
| Favicon | Multiple (32-180) | SVG preferred |
<picture> element.Icons and illustrations communicate ideas instantly. Consistent, well-designed icon systems improve usability, reinforce branding, and reduce cognitive load.
| Principle | Guideline |
|---|---|
| Consistency | Same stroke weight, corner radius, style across set |
| Clarity | Recognizable at small sizes (16-24px) |
| Simplicity | Minimal paths — avoid unnecessary detail |
| Alignment | Pixel-perfect on grid (use 24x24 artboard) |
| Optical balance | Adjust visually, not just mathematically |
| Meaningful | Use established metaphors (magnify = search) |
| Context | Size (px) | Stroke Width | Notes |
|---|---|---|---|
| Inline text | 14-16 | 1.5-2px | Align with text baseline |
| Button icon | 18-20 | 1.5-2px | Pair with button padding |
| Nav / toolbar | 20-24 | 1.5-2px | Consistent nav height |
| Card / list item | 24 | 1.5-2px | Standard icon size |
| Empty state | 48-64 | 1-1.5px | Thinner strokes at large size |
| Hero / feature | 64-96 | 1-1.5px | Detailed at large sizes |
| App icon | 48-192 | N/A (filled) | Use filled style for app icons |
| Library | Icons | Style | License | Best For |
|---|---|---|---|---|
| Lucide | 1500+ | Stroke (1.5px) | ISC (free) | React/Next.js apps, modern UI |
| Heroicons | 300+ | Stroke (1.5px) + solid | MIT (free) | Tailwind CSS ecosystem |
| Feather Icons | 300+ | Stroke (2px) | MIT (free) | Minimal, clean designs |
| Material Icons | 2500+ | Filled, outlined, etc. | Apache 2.0 | Android, Material UI apps |
| Phosphor Icons | 9000+ | 6 styles (thin-bold) | MIT (free) | Flexible, highly customizable |
| Tabler Icons | 5200+ | Stroke (2px) | MIT (free) | Large collection, web apps |
| Font Awesome | 2000+ | Solid, regular, brands | CC BY 4.0/SIL | General purpose, brands |
| Remix Icon | 2800+ | Line + fill | Apache 2.0 | Open source projects |
// ── Lucide Icons in React ──
import { Search, Bell, Settings, ChevronRight } from 'lucide-react';
function Header() {
return (
<header className="flex items-center justify-between p-4">
<Search size={20} strokeWidth={1.5} />
<Bell size={20} className="text-gray-500" />
<Settings size={20} />
<ChevronRight size={16} />
</header>
);
}
// ── Heroicons (Tailwind ecosystem) ──
// npm install @heroicons/react
import { MagnifyingGlassIcon } from '@heroicons/react/24/outline';
function SearchBar() {
return (
<div className="relative">
<MagnifyingGlassIcon className="absolute left-3 top-3 h-5 w-5" />
<input type="text" className="pl-10 pr-4 py-2 border rounded" />
</div>
);
}<!-- ── Optimized SVG Icon Template ── -->
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<!-- Your paths here -->
<circle cx="11" cy="11" r="8" />
<path d="m21 21-4.3-4.3" />
</svg>
<!-- ── As React Component ── -->
// Convert to TSX: replace stroke-width with strokeWidth,
// stroke-linecap with strokeLinecap, etc.
// Set width/height via props or className for sizing.| Use Icons | Use Text |
|---|---|
| Universal actions (search, close) | Unique or ambiguous actions |
| Navigation items | New or uncommon features |
| Status indicators (success, error) | Content that needs explanation |
| Space-constrained UIs (mobile) | When clarity matters more than space |
| Repeated actions (like, share) | Primary CTAs and important labels |
| Style | Description | Use Case |
|---|---|---|
| Flat / Minimal | Bold shapes, limited colors, clean | Onboarding, marketing |
| Line Art | Single stroke, monochrome | Empty states, documentation |
| Isometric | 3D perspective, detailed | Tech products, infographics |
| Hand-drawn | Organic lines, playful | Education, casual brands |
| 3D / Claymorphism | Soft 3D, realistic shading | Modern apps, hero sections |
| Abstract | Shapes, gradients, textures | Backgrounds, decorative |
aria-hidden="true" to decorative icons and providearia-label or title for interactive icons. Screen readers announce decorative SVGs, which confuses users.A smooth design-to-development handoff reduces rework, speeds up implementation, and ensures pixel-perfect results. This section covers checklists, CSS units, animations, and state design.
| Category | Checklist Item |
|---|---|
| Layout | All spacing uses 4/8pt grid values |
| Layout | Responsive breakpoints documented (mobile, tablet, desktop) |
| Layout | Max-width containers defined for content areas |
| Typography | Font family, size, weight, line-height for every text style |
| Typography | Responsive font sizes provided (clamp or breakpoint values) |
| Colors | All colors as hex or design tokens (not named) |
| Colors | Hover, active, focus, disabled states specified |
| Components | All interactive states documented (default, hover, focus, active, disabled, error) |
| Components | Spacing between components using gap/margin system |
| Assets | SVG icons exported and optimized (SVGO) |
| Assets | Images exported at 1x and 2x for retina |
| Assets | Image placeholder dimensions specified |
| Animation | Easing, duration, delay for every transition |
| Accessibility | Color contrast ratios verified (WCAG AA) |
| Accessibility | Focus order and visible focus indicators defined |
| Edge Cases | Long text, empty states, loading, error states designed |
| Unit | Type | Description | Best For |
|---|---|---|---|
| px | Absolute | Fixed pixel value | Borders, exact sizes |
| rem | Relative | Root font size (16px default) | Typography, spacing, most sizing |
| em | Relative | Parent font size | Within components (buttons, inputs) |
| % | Relative | Parent element size | Widths, heights, responsive layouts |
| vw / vh | Viewport | 1% of viewport width/height | Full-width sections, hero heights |
| dvw / dvh | Viewport | Dynamic viewport (accounts for mobile chrome) | Mobile layouts |
| clamp() | Fluid | min, preferred, max | Responsive typography, spacing |
| svh / lvh | Viewport | Small/large viewport height | Mobile-optimized heights |
| fr | Grid | Fractional unit in grid | CSS Grid column layout |
<!-- ── Responsive Image Strategy ── -->
<picture>
<!-- AVIF for modern browsers -->
<source
srcset="hero.avif"
type="image/avif"
/>
<!-- WebP fallback -->
<source
srcset="hero.webp"
type="image/webp"
/>
<!-- JPEG fallback for old browsers -->
<img
src="hero.jpg"
alt="Hero description"
width="1200"
height="600"
loading="lazy"
decoding="async"
fetchpriority="high"
/>
</picture>
<!-- ── Art Direction with srcset ── -->
<img
src="team-photo-small.jpg"
srcset="team-photo-large.jpg 1024w,
team-photo-medium.jpg 640w,
team-photo-small.jpg 320w"
sizes="(max-width: 640px) 100vw,
(max-width: 1024px) 50vw,
33vw"
alt="Team working together"
loading="lazy"
/>| Principle | UI Application | CSS Property |
|---|---|---|
| Ease In / Out | Natural feel — slow start/end | cubic-bezier(0.4, 0, 0.2, 1) |
| Anticipation | Prepare user for change (hover hint) | transform: scale(1.02) |
| Follow Through | Element settles after motion | Overshoot with spring curve |
| Staging | Direct attention to what changes | Highlight + animate only key area |
| Timing | Duration matches importance | Fast for buttons (150ms), slow for pages (300ms) |
| Exaggeration | Make micro-changes noticeable | Scale (1.05), opacity shift |
| Secondary Action | Background reacts to primary | Subtle fade of related elements |
| Appeal | Motion should feel delightful | Bounce, spring curves |
| Squash & Stretch | Buttons press, cards expand | transform: scaleY(0.95) on active |
| Straight Ahead | Predictable, linear paths | translateX / translateY (linear) |
| Solid Drawing | 3D depth in transitions | transform: perspective(1000px) |
| Overlap | Stagger animations for lists | transition-delay: calc(var(--i) * 50ms) |
| Trigger | Example | Duration |
|---|---|---|
| Button hover | Subtle scale + shadow lift | 150ms |
| Button press | Scale down (0.97) + darker | 100ms |
| Toggle switch | Smooth slide with color change | 200ms |
| Card hover | Lift shadow + slight scale | 200ms |
| Checkbox check | Scale bounce + fill color | 250ms |
| Toast notification | Slide in from top + fade | 300ms |
| Tooltip appear | Fade + slight translate | 150ms |
| Modal open | Fade overlay + scale up content | 250ms |
| Nav item hover | Background slide + underline | 200ms |
| Skeleton pulse | Shimmer gradient animation | 1500ms loop |
| State | Visual Treatment |
|---|---|
| Default | Primary colors, full opacity, clear labels |
| Hover | Subtle background change, cursor pointer, slight lift |
| Focus | Visible ring/outline (2px offset), matching brand color |
| Active / Pressed | Scale down (0.97-0.98), darker shade |
| Disabled | 50% opacity, no cursor pointer, reduced contrast |
| Loading | Skeleton screens, spinner, progress bar |
| Empty | Illustration + helpful message + CTA |
| Error | Red accent, error message, recovery action |
| Success | Green accent, checkmark, auto-dismiss toast |
| State | Components | Best Practice |
|---|---|---|
| Loading | Skeleton screen, spinner, progress bar | Skeleton > spinner (reduces perceived wait) |
| Empty | Illustration + heading + description + CTA | Tell users WHY it is empty and HOW to fix |
| Error | Icon + message + retry button + details | Use plain language, offer recovery actions |
| No Results | Illustration + search tips + clear filters | Suggest alternative search terms |
| Offline | Warning icon + cached content notice | Show what is available without network |
| Rate Limited | Timer + countdown + retry CTA | Be transparent about when to try again |
/* ── Design Token: Animation System ── */
:root {
/* Durations */
--duration-instant: 100ms;
--duration-fast: 150ms;
--duration-normal: 200ms;
--duration-slow: 300ms;
--duration-slower: 500ms;
/* Easing curves */
--ease-default: cubic-bezier(0.4, 0, 0.2, 1);
--ease-in: cubic-bezier(0.4, 0, 1, 1);
--ease-out: cubic-bezier(0, 0, 0.2, 1);
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
--ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
--ease-bounce: cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
/* Respects user motion preference */
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
transition-duration: 0.01ms !important;
}
}