Copied!
Design Your Way
Interface Design Reference

UI Design
Cheat Sheet

Every system, rule, and principle a product designer needs, with interactive tools for spacing, contrast, motion, dark mode, and more.

Dashboard
Reports
Settings
Action
Skip
Ch 1Foundations
Contents
Everything in this cheat sheet
01 · Spacing
The 8-Point Spacing System

All spacing, sizing, and layout values derive from multiples of 8. Drag the slider to feel the difference between values, not just read them.

Spacing value32px (space-4)
TokenpxremCommon use

Why 8?

Most screens use pixel densities that divide evenly into 8. It maps cleanly to 4, 2, and 1 for micro-adjustments without breaking rhythm.

The 4px exception

Use 4px only for micro gaps: icon-label spacing, badge padding, input border offsets. Never for layout or component spacing.

Use rem in production

Set 1rem = 16px on :root. Use rem for spacing so browser font-size preferences scale your layout proportionally.

/* 8-point scale as CSS custom properties */ :root { --space-1: 0.25rem; /* 4px */ --space-2: 0.5rem; /* 8px */ --space-4: 1rem; /* 16px */ --space-6: 1.5rem; /* 24px */ --space-8: 2rem; /* 32px */ --space-12: 3rem; /* 48px */ --space-16: 4rem; /* 64px */ }
02 · Typography
Type Scale and Hierarchy

A modular scale generates all type sizes from one base and one ratio. Adjust both below and watch the hierarchy change live.

Base size16px
Scale ratio1.25 (Major Third)

Line height rules

Body: 1.5 to 1.75. Headings: 1.1 to 1.25. Captions: 1.4. Never go below 1.2 on running text. Tight line-height causes readers to re-read lines.

Letter spacing

Large headings: -0.02em to -0.04em. Body: 0. All-caps labels: +0.06em to +0.12em. Negative tracking on small text destroys legibility.

Line length

Optimal reading width: 60 to 75 characters. Use max-width: 65ch on paragraphs. Shorter than 40 chars feels choppy; longer than 90 chars strains the eye.

Weight usage

300: large display only. 400: body. 500: UI labels. 600: subheadings. 700: headings. Avoid 800/900 in body. Never use more than 3 weights per interface.

:root { --text-xs: 0.75rem; /* 12px — captions */ --text-sm: 0.875rem; /* 14px — labels */ --text-base: 1rem; /* 16px — body */ --text-lg: 1.125rem; /* 18px — lead */ --text-xl: 1.25rem; /* 20px — h4 */ --text-2xl: 1.5rem; /* 24px — h3 */ --text-3xl: 1.875rem; /* 30px — h2 */ --text-4xl: 2.25rem; /* 36px — h1 */ }
03 · Grid
Grid Systems and Layout Patterns

A grid is not just columns. Choose a breakpoint and a pattern below to see how real layouts use the grid.

Gutters

Desktop: 24 to 32px. Tablet: 16 to 24px. Mobile: 16px. Gutters create breathing room between columns. They are not the same as outer margins.

Max content width

Set a max-width on your content container, not a fixed width. 1100 to 1280px suits most sites. Use margin: 0 auto to center it.

Container queries

Modern CSS lets components respond to their parent container size, not just the viewport. This enables truly reusable design system components.

/* Responsive grid with CSS Grid */ .grid { display: grid; gap: var(--space-6); } @media (min-width: 640px) { .grid { grid-template-columns: repeat(4, 1fr); } } @media (min-width: 768px) { .grid { grid-template-columns: repeat(8, 1fr); } } @media (min-width: 1024px) { .grid { grid-template-columns: repeat(12, 1fr); } }
"Design is not just what it looks like and feels like. Design is how it works."
Steve Jobs
Ch 2Components and Patterns
04 · Anatomy
Component Anatomy and Tokens

Every component is made of named parts, each controlled by a design token. Naming the parts lets teams discuss, document, and override them precisely.

Button anatomy
Save changes
Input anatomy
Email address
user@example.com
We'll never share your email.

Token naming pattern

[component]-[part]-[property]-[state]. Example: button-bg-primary-hover. Semantic names decouple the design from a specific color value, enabling full re-theming.

Why anatomy matters

Without named parts, design handoff becomes "make it a bit darker" or "add some padding." Named parts + tokens means "set button-bg-primary to brand-500" -- unambiguous and systematic.

05 · States
Interactive Component States

Every interactive component must handle all states. Click each component below to cycle through its states and see how they should look and behave.

Button -- click to cycle states
Current: Default
All states at a glance

Empty states

Never show a blank screen. Provide an illustration, explanation of what belongs here, and a primary CTA to add content. Empty states are conversion opportunities.

Loading states

Show a skeleton screen for content taking more than 300ms. Skeletons should mirror the final layout shape. Use spinners only for indeterminate full-page loads.

Error states

Error messages must explain what went wrong and what the user can do next. "An error occurred" is not a valid message. Be specific. Be human.

06 · Navigation
Navigation Patterns

Navigation is the skeleton of any product. The wrong pattern leaves users lost regardless of how polished the rest of the UI is.

Top nav bar

5 to 7 primary destinations. Always visible. Use dropdowns for deep hierarchies. Pair with breadcrumbs for orientation.

DesktopFlat hierarchy

Side nav / rail

6 to 12 sections with persistent context-switching. Icon rail scales from expanded to collapsed. Keep to one level deep.

Web appsDashboards

Tab bar

3 to 5 top-level destinations on mobile. Always visible. Use icons with labels. Active tab needs a filled indicator, not just color.

MobilePrimary nav

Hamburger / drawer

Hides navigation. Acceptable for secondary items only. Never put the most important destinations inside a hamburger menu.

Mobile secondary

Tabs vs. navigation

Tabs switch views of the same content type. Navigation moves between different pages or sections. Confusing these leads to deeply broken information architecture.

Breadcrumbs

For hierarchies deeper than 3 levels. Show the full path. Never make the current page a link. Keep separators visually lighter than labels.

Pagination vs. infinite scroll

Pagination for task-oriented content (search, tables). Infinite scroll for feed-based browsing. Never combine infinite scroll with a page footer.

Ch 3Visual System
07 · Elevation
Elevation, Shadows, and Visual Separation

Three tools create visual separation: shadows, borders, and background color changes. Each carries a different connotation. Use them deliberately, not interchangeably.

Shadow elevation scale -- click any card to copy its shadow
Shadow separation
Card A
Card B

Implies depth and interactivity. Best for cards, buttons, and overlays.

Border separation
Card A
Card B

Structural, flat, no depth implied. Good for forms, tables, and data-dense layouts.

Background separation
Card A
Card B

Softest signal. Groups content zones without implying hierarchy. Best for layout sections.

Dark mode shadows

Drop shadows are nearly invisible on dark backgrounds. Use surface tint instead: each elevation level is a slightly lighter background. This is how Material You handles dark mode depth.

Do not mix methods

Cards in the same interface should all use the same separation method. Mixing shadows and borders for the same component type signals inconsistency and breaks the visual language.

:root { --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04); --shadow-md: 0 4px 12px rgba(0,0,0,0.1); --shadow-lg: 0 8px 24px rgba(0,0,0,0.12); --shadow-xl: 0 16px 48px rgba(0,0,0,0.15); }
08 · Border Radius
Border Radius and Brand Personality

Border radius is not decoration. It communicates brand personality on a spectrum from approachable to authoritative. Your radius system should be intentional and consistent.

0px
Sharp
4px
Subtle
8px
Default
12px
Friendly
16px
Soft
24px
Bubbly
Full
Pill

0px -- Sharp, authoritative

Used by financial institutions, enterprise software, and government services. Communicates precision, rigidity, and formality. Bloomberg, Reuters, and most bank dashboards.

4 to 8px -- Neutral, professional

The default for most B2B products. Approachable but serious. Works across most industries without sending a strong personality signal. GitHub, Notion, Linear.

12 to 24px -- Friendly, consumer

Consumer apps, social products, and tools targeting creatives. Slack, Figma, and most startup products live in this range. Signals approachability and warmth.

:root { --radius-sm: 4px; /* badges, chips, small elements */ --radius-md: 8px; /* inputs, buttons */ --radius-lg: 12px; /* cards */ --radius-xl: 16px; /* modals, panels */ --radius-full: 9999px; /* pills, avatars */ }
09 · Motion
Motion and Animation

Motion communicates relationships, feedback, and hierarchy. Watch each ball to see how different easing curves feel -- linear is robotic; spring feels alive.

Click any row to animate
Duration guidelines

Easing reference

ease-out: Elements entering the screen. ease-in: Elements leaving. ease-in-out: Moving between two positions. Spring: Micro-interactions and delight moments. Linear: Progress indicators only.

Reduced motion

Always implement prefers-reduced-motion: reduce. Replace animations with instant state changes or simple opacity fades. Vestibular disorders affect 35% of adults over 40.

/* Always pair animations with reduced-motion fallback */ @media (prefers-reduced-motion: no-preference) { .slide-in { animation: slideUp 200ms cubic-bezier(0.0, 0.0, 0.2, 1) both; } } @keyframes slideUp { from { opacity: 0; transform: translateY(8px); } }
"Good design is obvious. Great design is transparent."
Joe Sparano
Ch 4Accessibility and Systems
10 · Accessibility
Contrast Checker (WCAG 2.2)

Color contrast is a legal accessibility requirement in many jurisdictions. Test any pair below against both WCAG 2.2 and the newer APCA standard.

Aa Sample Text
WCAG 2.2 ratio
15.3 : 1 AAA
APCA (WCAG 3 draft)
Lc 108
AA Normal (4.5:1)
AA Large (3:1)
AAA Normal (7:1)
Pick colors to test
Background#1a237e
Foreground#ffffff
WCAG 2.2AA: 4.5:1 normal, 3:1 large (18px+)
AAA: 7:1 normal, 4.5:1 large
APCA thresholdsLc 45: body text min
Lc 60: subheadings
Lc 75: fluent body text

Relative luminance

WCAG uses a weighted RGB formula. Green contributes 71.5%, red 21.3%, blue 7.2% -- matching human cone sensitivity. Two luminance values give you the contrast ratio.

Non-text contrast

UI components and icons need 3:1 against adjacent colors (WCAG 1.4.11). Often missed: input borders, icon fills, focus rings, and chart lines.

Never color alone

WCAG 1.4.1: color cannot be the only visual means of conveying information. Links need underlines. Error states need icons or text. Charts need patterns or labels.

11 · Design Tokens
Design Token Architecture

Design tokens are the single source of truth for design decisions. Three tiers decouple raw values from meaning from component usage, enabling theming at scale.

Tier 1: Primitives

Named by value, not meaning

Tier 2: Semantic

Named by role, references primitives

Tier 3: Component

Scoped to one component

Naming convention

[category]-[property]-[variant]-[state]. Example: color-action-primary-hover. Avoid names that encode the value: blue-500 is a primitive. color-brand-primary is semantic.

Output formats

CSS custom properties for web. Swift enums for iOS. Kotlin constants for Android. JSON as the shared source. Style Dictionary transforms one JSON source into all platform formats automatically.

Theming power

Swap semantic tokens to switch from light to dark mode, or from one brand to another. The component code never changes -- only the token map changes. This is how multi-brand design systems work.

/* Tier 1: Primitives */ :root { --blue-500: #0ea5e9; --blue-600: #0284c7; } /* Tier 2: Semantic */ :root { --color-action-primary: var(--blue-500); } /* Tier 3: Component */ .btn-primary { background: var(--color-action-primary); } /* Dark mode: only update semantic tier */ [data-theme="dark"] { --color-action-primary: var(--blue-400); }
12 · Dark Mode
Dark Mode Design

Dark mode is not color inversion. Toggle the switch below to see how tokens remap -- and why each design decision is different from the light version.

Light mode active -- click to switch
Light mode
Account settings
Manage your profile and preferences

Surface tint for depth

On dark backgrounds, drop shadows vanish. Use slightly lighter surface backgrounds to imply elevation: each layer 5 to 8% lighter than the one below.

Reduce saturation

Fully saturated colors look harsh on dark surfaces. Decrease saturation 10 to 20% and increase lightness slightly for dark-mode accent colors. Avoid neon unless it is your brand.

Never pure black

#000000 causes halation -- text appears to bleed against pitch black. Use #0f172a or #121212 as the base surface. Pure black is reserved for OLED battery-saving modes only.

Semantic tokens are the key

Never hardcode colors in components. Reference semantic tokens. Then dark mode is just a second token map -- your components never change, only the values behind the tokens change.

13 · Z-Index
Z-Index Management and Stacking Contexts

Z-index bugs are among the most common and frustrating UI issues. A defined z-index scale and an understanding of stacking contexts prevents them entirely.

Stacking contexts

A new stacking context is created by transform, opacity < 1, filter, will-change, position + z-index, and isolation: isolate. A child can never escape its parent stacking context, which is why a dropdown inside a transformed container appears below a modal.

Use isolation to fix bugs

Add isolation: isolate to a component wrapper to create a deliberate stacking context without using z-index or position. This contains the component's internal z-index wars without affecting the rest of the document.

:root { --z-base: 0; /* default document flow */ --z-raised: 10; /* sticky elements, raised cards */ --z-dropdown: 100; /* dropdowns, popovers */ --z-sticky: 200; /* sticky header/nav */ --z-overlay: 300; /* page overlays, backdrops */ --z-modal: 400; /* modals, dialogs */ --z-toast: 500; /* toasts, notifications */ --z-tooltip: 600; /* tooltips (above everything) */ }
"The details are not the details. They make the design."
Charles Eames
Ch 5Visual Principles and Practice
14 · Perception
Gestalt Principles

The brain groups visual elements automatically. Mastering these six principles means controlling perceived relationships without adding any visual noise.

15 · Hierarchy
Visual Hierarchy

Hierarchy guides the eye through content in order of importance. It is built from size, weight, color, contrast, spacing, and position -- never decoration.

Without hierarchy -- every element shouts equally
Account settings
Save changes
John Appleseed
Edit profile
Danger zone
With hierarchy -- eye moves intentionally
John Appleseed
Account settings
Edit profile
Danger zone

Size and weight

The most powerful hierarchy signal. A 32px bold heading dominates a 14px regular body without any color help. Use a maximum of 3 visual weight levels per screen.

Color and contrast

High contrast implies high importance. Use your text color scale: primary (high emphasis), secondary (medium), tertiary (low). Resist adding more than 3 text color roles.

Whitespace as signal

More space around an element implies higher importance. Use generous spacing to elevate primary content, reducing the need for borders or dividers to create structure.

16 · Composition
The 60-30-10 Rule and Information Density

60-30-10 governs color dominance. Density governs how much information fits comfortably. Both are composition tools, not rules to follow blindly.

60-30-10 in UI color
60% Neutral base (backgrounds, surfaces) 30% Brand primary (nav, headers, interactive) 10% Accent (CTAs, alerts, highlights)
Density by use case
Comfortable
48-64px rows -- onboarding, mobile, checkout
Default
36-44px rows -- general app UI, dashboards
Compact
24-32px rows -- data tables, admin tools

Breaking the 60-30-10 rule

Dark mode, editorial design, and marketing pages often use 80-15-5 or full inversions. The rule prevents visual chaos in functional interfaces. Creative contexts may deliberately ignore it.

User-adjustable density

Enterprise tools benefit from density controls (Comfortable / Default / Compact). Gmail, Notion, and Linear all offer this. Persist the preference per user account, not per session.

17 · Content
Microcopy and UX Writing

Microcopy is the smallest copy with the largest impact. Button labels, error messages, empty states, and tooltips are all moments of conversation with your user.

ContextWeakStrong

Active voice

"Your file was deleted" is passive. "File deleted" is active. Active voice is faster to read and sounds more confident. Reserve passive voice for when the agent is unknown or unimportant.

Specificity builds trust

"Done" tells the user nothing. "Message sent to sarah@co.com" confirms exactly what happened. Specific feedback reduces anxiety and builds confidence in the system.

Plain language

Write at a 7th-grade reading level for general audiences. Avoid jargon and system-internal terms. "Something went wrong" beats "Error 500 Internal Server Error" every time.

18 · Principles
10 Core UI Design Principles

These principles underpin every good interface ever designed. When in doubt, return to these before adding anything new.

"Simplicity is not the absence of clutter -- it is the achievement of clarity."
Jonathan Ive
Ch 6Quick Reference
19 · Accessibility
Accessibility Checklist (WCAG 2.2)

Accessibility is not a checklist -- it is a design quality. Inaccessible UI is broken UI for 1.3 billion people globally who have some form of disability.

Focus management

Every interactive element needs a visible focus ring. WCAG 2.4.11 (Focus Appearance) is new in 2.2. Minimum 2px outline, 3:1 contrast against the adjacent color. Never outline: none without a replacement.

ARIA: supplement, not replace

Use native HTML elements first. <button> is better than <div role="button"> because it gets keyboard focus, click events, and semantics for free. ARIA only supplements what native HTML cannot express.

20 · Responsive
Responsive Design and Breakpoints

Design for content, not device sizes. Breakpoints should emerge from where the layout breaks, not from a list of current screen widths.

Mobile first

Start with the smallest layout and layer complexity up. Use min-width queries. This prevents CSS bloat from overrides and ensures a baseline that always works.

Fluid sizing with clamp()

clamp(min, preferred, max) creates fluid type and spacing that scales with the viewport without any media queries. Combine with vw units for true fluid scaling.

Container queries

Components can now respond to their parent container size with @container. This enables truly reusable components that adapt to any context, not just the viewport.

/* Fluid type: scales from 16px at 320px to 20px at 1280px */ body { font-size: clamp(1rem, 0.875rem + 0.625vw, 1.25rem); } /* Container query example */ .card-grid { container-type: inline-size; } @container (min-width: 480px) { .card { grid-template-columns: 1fr 1fr; } }
21 · Forms
Form Design Best Practices

Forms are the highest-friction UI pattern. Every unnecessary field costs conversions. Every missing validation message costs trust.

Patterns to avoid
Placeholder as label
Vague error message
Invalid input.
Better patterns
We never share your email.
Must be at least 3 characters long.

Label placement

Top-aligned labels outperform side-aligned labels in form completion rate. Floating labels save vertical space but hurt readability. Placeholder text is not a label substitute -- it disappears when typing begins.

Validation timing

Validate on blur (after leaving the field), not on every keystroke. Validate on submit as a final check. Showing errors while the user is still typing causes frustration before they have finished.

Required vs. optional

When most fields are required, mark optional ones with "(optional)" instead. The asterisk convention is widely misunderstood. If you use asterisks, always show a legend explaining them.

Input sizing

Width should hint at expected content length. A 4-digit PIN field should be narrow. A biography textarea should be wide and multi-line. Full-width inputs for short data are a form anti-pattern.

22 · Feedback
Feedback Patterns

Feedback tells users whether their action worked, failed, or is in progress. The right pattern depends on urgency, interruption cost, and whether persistence is needed.

Toast timing

4 to 6 seconds visibility. Include an undo option for destructive actions. Pause the timer on hover. Never use a toast for an error that blocks the user from continuing.

Modals should be rare

Use modals for decisions requiring full attention that cannot be undone. Use inline patterns for everything else. Every unnecessary modal erodes user trust and breaks flow.

23 · Iconography
Icon System Design

Icons are a visual language. Consistency in stroke weight, optical sizing, and style determines whether your icon set feels like a system or an accidental collection.

Stroke weight scales with size -- same icon, 4 sizes
32px / 1.5sw
24px / 1.75sw
20px / 2sw
16px / 2.5sw
Stroke weight must increase as icon size decreases. At 16px use 2 to 2.5px stroke; at 32px use 1.25 to 1.5px. This maintains perceived visual weight across sizes.

Icon + label always

Tests consistently show icon-only navigation is misunderstood -- except for universally recognized symbols (home, close, search, back). When in doubt, add a label. Icons alone fail new users.

Style consistency

Choose one style (outline, filled, or duotone) and apply it everywhere. Mixing styles within an interface signals a lack of intention and makes the UI feel assembled rather than designed.

Touch targets

An 18px icon still needs a 44x44px touch target. Extend the hit area with padding, or use a transparent click wrapper. Never shrink the touch target to match the visual size of the icon.

Optical sizing

At small sizes, simplify the icon: remove fine details, increase stroke weight, round corners more aggressively. Same concept, different geometry. Scaling the same SVG down does not work.

24 · Quick Reference
Numbers Every UI Designer Should Know

These numbers come up constantly. Memorize them and you will spend less time looking things up and more time designing.