Web Interface Design Guidelines
Applies comprehensive web interface design guidelines covering layout, typography, color accessibility, responsive design, UX patterns, and visual hierarchy. These rules ensure interfaces are usable, inclusive, and consistent across devices and interaction modes. This skill acts as a design reference — load it when reviewing or creating web interface code.
TL;DR Checklist
When to Use
Use this skill when:
- Designing or reviewing web application user interfaces for consistency and usability
- Implementing a new component or page and needing design pattern guidance
- Auditing an existing interface for accessibility compliance (WCAG)
- Setting up a design system or component library with shared UX patterns
- Writing CSS for responsive layouts, typography scales, or accessible color systems
- Reviewing pull requests that touch UI components, layout, or styling
- Onboarding new developers to interface design standards
When NOT to Use
Avoid this skill for:
- UI motion/animation design — use
react-view-transitions for transition-specific guidance
- Deep design system token architecture — use
design-systems for token hierarchy
- Backend service interface design — this applies only to frontend user interfaces
- Print or native mobile design — these guidelines are specific to web interfaces
- Brand identity or visual language creation — this covers implementation, not brand definition
Core Workflow
Analyze User Needs and Task Flows — Identify the primary tasks users will perform on the interface. Map user journeys to understand the sequence of screens and interactions. Define success criteria for each task (time to complete, error rate, satisfaction). Checkpoint: Write down the top 3 user goals for the interface before writing any code.
Design Layout Structure with Consistent Spacing — Establish a baseline grid (typically 4px or 8px increments) and use it consistently for margins, padding, and gaps. Define the page layout using CSS Grid or Flexbox with clear content regions. Maintain consistent whitespace between related and unrelated elements (tighter spacing within groups, looser between groups). Checkpoint: Verify that spacing values are multiples of the baseline grid and no arbitrary values are used.
Apply Typography Scale with Accessible Sizes — Define a typography scale with 4-6 sizes (e.g., 0.875rem, 1rem, 1.25rem, 1.5rem, 2rem, 3rem). Set body text to at least 16px (1rem) with a line-height of 1.5-1.6 for readability. Ensure heading line-height is tighter (1.2-1.3). Limit line length to 60-75 characters for optimal readability. Checkpoint: Test body text readability at 400% zoom — content should not overflow or clip.
Select Color Palette Meeting WCAG AA Contrast — Choose a primary, secondary, neutral, and semantic color (success, warning, error, info). Verify all text/background combinations against WCAG AA: 4.5:1 for normal text, 3:1 for large text (18px+ bold or 24px+ regular) and UI components. Use tools like the WebAIM Contrast Checker to validate. Checkpoint: The lowest contrast ratio in the palette must exceed 4.5:1 for body text, 3:1 for large text and UI borders.
Ensure Keyboard Navigation and Screen Reader Support — Verify every interactive element is reachable via Tab key in logical order. Use :focus-visible for focus indicators (not :focus or outline: none alone). Add aria-label or aria-labelledby to elements without visible text labels. Use semantic HTML (<nav>, <main>, <button>, <a>) instead of generic <div> with ARIA roles. Checkpoint: Tab through the entire interface — every interactive element must be reachable and activate with Enter or Space.
Test Responsive Behavior Across Breakpoints — Start with the smallest viewport (320px) and progressively enhance. Use CSS Grid with auto-fit/minmax for fluid layouts. Ensure touch targets are at least 44x44px (with 8px gap between adjacent targets). Test content reflow at 400% zoom — content should not require horizontal scrolling. Checkpoint: At 320px width, all functionality must be usable without horizontal scrolling or hidden controls.
Implementation Patterns
Pattern 1: Accessible Color Palette
/* ✅ GOOD: Accessible color palette with WCAG AA-compliant pairings */
:root {
/* Primary palette */
--color-primary-50: #eff6ff;
--color-primary-100: #dbeafe;
--color-primary-500: #3b82f6;
--color-primary-600: #2563eb;
--color-primary-700: #1d4ed8;
--color-primary-900: #1e3a5f;
/* Neutral palette */
--color-neutral-50: #f8fafc;
--color-neutral-100: #f1f5f9;
--color-neutral-300: #cbd5e1;
--color-neutral-500: #64748b;
--color-neutral-700: #334155;
--color-neutral-900: #0f172a;
/* Semantic palette */
--color-success: #16a34a;
--color-warning: #d97706;
--color-error: #dc2626;
--color-info: #2563eb;
/* Text colors (all pass WCAG AA on white background) */
--color-text-primary: #0f172a; /* 15.3:1 on white */
--color-text-secondary: #475569; /* 7.0:1 on white */
--color-text-tertiary: #64748b; /* 4.8:1 on white */
--color-text-inverse: #f8fafc; /* 15.3:1 on #0f172a */
/* Background colors */
--color-bg-primary: #ffffff;
--color-bg-secondary: #f8fafc;
--color-bg-tertiary: #f1f5f9;
}
/* ❌ BAD: Insufficient contrast — text is hard to read */
.bad-text {
color: #94a3b8; /* 2.8:1 on white — fails WCAG AA */
background: #ffffff;
}
.good-text {
color: var(--color-text-secondary); /* 7.0:1 on white — passes WCAG AA */
background: var(--color-bg-primary);
}
Pattern 2: Responsive Grid Layout
/* ✅ GOOD: Fluid responsive grid with consistent spacing */
.layout-grid {
--grid-gap: 1.5rem;
--content-max-width: 1200px;
--side-padding: 1rem;
display: grid;
grid-template-columns:
minmax(var(--side-padding), 1fr)
minmax(0, var(--content-max-width))
minmax(var(--side-padding), 1fr);
gap: var(--grid-gap);
}
.layout-grid > * {
grid-column: 2;
}
.layout-grid > .full-width {
grid-column: 1 / -1;
}
/* Card grid: auto-fill responsive cards */
.card-grid {
display: grid;
grid-template-columns: repeat(
auto-fill,
minmax(min(280px, 100%), 1fr)
);
gap: 1.5rem;
}
/* Touch target sizing */
.interactive-element {
min-height: 44px;
min-width: 44px;
display: inline-flex;
align-items: center;
justify-content: center;
}
/* Space between adjacent touch targets */
.toolbar {
display: flex;
gap: 0.5rem; /* 8px minimum gap between adjacent targets */
}
<!-- ❌ BAD: No visible label on icon-only button -->
<button class="icon-button">
<svg><!-- search icon --></svg>
</button>
<!-- ✅ GOOD: Accessible icon button with screen reader label -->
<button class="icon-button" aria-label="Search">
<svg aria-hidden="true" focusable="false">
<!-- search icon -->
</svg>
</button>
Pattern 3: Form Design with Validation
import { useState, type ChangeEvent, type FormEvent } from "react";
interface FormFieldProps {
label: string;
name: string;
type?: "text" | "email" | "password";
required?: boolean;
error?: string;
value: string;
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
}
function FormField({
label,
name,
type = "text",
required = false,
error,
value,
onChange,
}: FormFieldProps) {
const errorId = `${name}-error`;
const descriptionId = error ? errorId : undefined;
return (
<div className="form-field">
<label htmlFor={name} className="form-field__label">
{label}
{required && <span aria-hidden="true" className="required-mark"> *</span>}
</label>
<input
id={name}
name={name}
type={type}
value={value}
required={required}
aria-invalid={error ? "true" : undefined}
aria-describedby={descriptionId}
className={`form-field__input ${error ? "form-field__input--error" : ""}`}
/>
{error && (
<p id={errorId} className="form-field__error" role="alert">
{error}
</p>
)}
</div>
);
}
// Usage
function SignupForm() {
const [email, setEmail] = useState("");
const [error, setError] = useState("");
const handleSubmit = (event: FormEvent) => {
event.preventDefault();
if (!email.includes("@")) {
setError("Please enter a valid email address");
return;
}
setError("");
// Submit form...
};
return (
<form noValidate>
<FormField
label="Email Address"
name="email"
type="email"
required
error={error}
value={email}
=> setEmail(event.target.value)}
/>
<button type="submit">Sign Up</button>
</form>
);
}
Constraints
MUST DO
- Meet WCAG 2.1 AA minimum contrast: 4.5:1 for normal text, 3:1 for large text (18px+ bold or 24px+ regular) and UI component boundaries
- Provide visible focus indicators on all interactive elements using
:focus-visible — never set outline: none without a replacement
- Support full keyboard-only navigation — every interactive element must be reachable and operable with Tab, Enter, Space, and Arrow keys
- Provide clear error messages for form validation that describe what went wrong and how to fix it
- Design mobile-first with progressive enhancement — test at 320px minimum viewport width
- Use semantic HTML elements (
<nav>, <main>, <article>, <button>, <a>) over generic <div> and <span> with ARIA roles
MUST NOT DO
- Convey information using color alone — always pair color indicators with text labels, icons, or patterns
- Disable zoom or pinch-to-zoom — respect user viewport preferences with
viewport meta tag
- Use
aria-hidden="true" on focusable elements — hidden elements must not be interactive
- Remove focus outlines without providing an alternative visible focus indicator
- Use placeholder text as a substitute for visible labels on form inputs
- Design dismissable toast notifications that disappear before a screen reader can announce them
- Use generic alt text like "image" or "photo" — describe the content and function of each image
Related Skills
| Skill |
Purpose |
css-architecture |
Organizing and structuring CSS for maintainable design systems |
design-systems |
Building and maintaining design system component libraries |
frontend-philosophy |
Visual design principles for distinctive, intentional UI |
react-view-transitions |
Implementing smooth page transitions with the View Transition API |
Live References
Authoritative documentation links for this skill's domain. The model follows markdown links at load time to resolve external references and inline content.
1---2name: web-interface-guidelines3description: Applies comprehensive web interface design guidelines covering layout, typography, color, accessibility, responsive design, and UX patterns for consistent, user-friendly interfaces.4license: MIT5---67# Web Interface Design Guidelines89Applies comprehensive web interface design guidelines covering layout, typography, color accessibility, responsive design, UX patterns, and visual hierarchy. These rules ensure interfaces are usable, inclusive, and consistent across devices and interaction modes. This skill acts as a design reference — load it when reviewing or creating web interface code.1011## TL;DR Checklist1213- [ ] Check color contrast ratios meet WCAG AA minimum (4.5:1 for text, 3:1 for large text and UI components)14- [ ] Verify keyboard navigation — every interactive element must be reachable and operable via keyboard15- [ ] Test responsive layout at 320px, 768px, 1024px, and 1440px breakpoints16- [ ] Confirm no information is conveyed by color alone — add text labels or icons17- [ ] Review touch targets meet minimum 44x44px size on interactive elements18- [ ] Validate all form inputs have visible, programmatically-associated labels19- [ ] Check that loading, error, and empty states are implemented for all data-displaying components2021---2223## When to Use2425Use this skill when:2627- Designing or reviewing web application user interfaces for consistency and usability28- Implementing a new component or page and needing design pattern guidance29- Auditing an existing interface for accessibility compliance (WCAG)30- Setting up a design system or component library with shared UX patterns31- Writing CSS for responsive layouts, typography scales, or accessible color systems32- Reviewing pull requests that touch UI components, layout, or styling33- Onboarding new developers to interface design standards3435---3637## When NOT to Use3839Avoid this skill for:4041- UI motion/animation design — use `react-view-transitions` for transition-specific guidance42- Deep design system token architecture — use `design-systems` for token hierarchy43- Backend service interface design — this applies only to frontend user interfaces44- Print or native mobile design — these guidelines are specific to web interfaces45- Brand identity or visual language creation — this covers implementation, not brand definition4647---4849## Core Workflow50511. **Analyze User Needs and Task Flows** — Identify the primary tasks users will perform on the interface. Map user journeys to understand the sequence of screens and interactions. Define success criteria for each task (time to complete, error rate, satisfaction). **Checkpoint:** Write down the top 3 user goals for the interface before writing any code.52532. **Design Layout Structure with Consistent Spacing** — Establish a baseline grid (typically 4px or 8px increments) and use it consistently for margins, padding, and gaps. Define the page layout using CSS Grid or Flexbox with clear content regions. Maintain consistent whitespace between related and unrelated elements (tighter spacing within groups, looser between groups). **Checkpoint:** Verify that spacing values are multiples of the baseline grid and no arbitrary values are used.54553. **Apply Typography Scale with Accessible Sizes** — Define a typography scale with 4-6 sizes (e.g., 0.875rem, 1rem, 1.25rem, 1.5rem, 2rem, 3rem). Set body text to at least 16px (1rem) with a line-height of 1.5-1.6 for readability. Ensure heading line-height is tighter (1.2-1.3). Limit line length to 60-75 characters for optimal readability. **Checkpoint:** Test body text readability at 400% zoom — content should not overflow or clip.56574. **Select Color Palette Meeting WCAG AA Contrast** — Choose a primary, secondary, neutral, and semantic color (success, warning, error, info). Verify all text/background combinations against WCAG AA: 4.5:1 for normal text, 3:1 for large text (18px+ bold or 24px+ regular) and UI components. Use tools like the WebAIM Contrast Checker to validate. **Checkpoint:** The lowest contrast ratio in the palette must exceed 4.5:1 for body text, 3:1 for large text and UI borders.58595. **Ensure Keyboard Navigation and Screen Reader Support** — Verify every interactive element is reachable via Tab key in logical order. Use `:focus-visible` for focus indicators (not `:focus` or `outline: none` alone). Add `aria-label` or `aria-labelledby` to elements without visible text labels. Use semantic HTML (`<nav>`, `<main>`, `<button>`, `<a>`) instead of generic `<div>` with ARIA roles. **Checkpoint:** Tab through the entire interface — every interactive element must be reachable and activate with Enter or Space.60616. **Test Responsive Behavior Across Breakpoints** — Start with the smallest viewport (320px) and progressively enhance. Use CSS Grid with `auto-fit`/`minmax` for fluid layouts. Ensure touch targets are at least 44x44px (with 8px gap between adjacent targets). Test content reflow at 400% zoom — content should not require horizontal scrolling. **Checkpoint:** At 320px width, all functionality must be usable without horizontal scrolling or hidden controls.6263---6465## Implementation Patterns6667### Pattern 1: Accessible Color Palette6869```css70/* ✅ GOOD: Accessible color palette with WCAG AA-compliant pairings */7172:root {73 /* Primary palette */74 --color-primary-50: #eff6ff;75 --color-primary-100: #dbeafe;76 --color-primary-500: #3b82f6;77 --color-primary-600: #2563eb;78 --color-primary-700: #1d4ed8;79 --color-primary-900: #1e3a5f;8081 /* Neutral palette */82 --color-neutral-50: #f8fafc;83 --color-neutral-100: #f1f5f9;84 --color-neutral-300: #cbd5e1;85 --color-neutral-500: #64748b;86 --color-neutral-700: #334155;87 --color-neutral-900: #0f172a;8889 /* Semantic palette */90 --color-success: #16a34a;91 --color-warning: #d97706;92 --color-error: #dc2626;93 --color-info: #2563eb;9495 /* Text colors (all pass WCAG AA on white background) */96 --color-text-primary: #0f172a; /* 15.3:1 on white */97 --color-text-secondary: #475569; /* 7.0:1 on white */98 --color-text-tertiary: #64748b; /* 4.8:1 on white */99 --color-text-inverse: #f8fafc; /* 15.3:1 on #0f172a */100101 /* Background colors */102 --color-bg-primary: #ffffff;103 --color-bg-secondary: #f8fafc;104 --color-bg-tertiary: #f1f5f9;105}106107/* ❌ BAD: Insufficient contrast — text is hard to read */108.bad-text {109 color: #94a3b8; /* 2.8:1 on white — fails WCAG AA */110 background: #ffffff;111}112113.good-text {114 color: var(--color-text-secondary); /* 7.0:1 on white — passes WCAG AA */115 background: var(--color-bg-primary);116}117```118119### Pattern 2: Responsive Grid Layout120121```css122/* ✅ GOOD: Fluid responsive grid with consistent spacing */123124.layout-grid {125 --grid-gap: 1.5rem;126 --content-max-width: 1200px;127 --side-padding: 1rem;128129 display: grid;130 grid-template-columns:131 minmax(var(--side-padding), 1fr)132 minmax(0, var(--content-max-width))133 minmax(var(--side-padding), 1fr);134 gap: var(--grid-gap);135}136137.layout-grid > * {138 grid-column: 2;139}140141.layout-grid > .full-width {142 grid-column: 1 / -1;143}144145/* Card grid: auto-fill responsive cards */146.card-grid {147 display: grid;148 grid-template-columns: repeat(149 auto-fill,150 minmax(min(280px, 100%), 1fr)151 );152 gap: 1.5rem;153}154155/* Touch target sizing */156.interactive-element {157 min-height: 44px;158 min-width: 44px;159 display: inline-flex;160 align-items: center;161 justify-content: center;162}163164/* Space between adjacent touch targets */165.toolbar {166 display: flex;167 gap: 0.5rem; /* 8px minimum gap between adjacent targets */168}169```170171```html172<!-- ❌ BAD: No visible label on icon-only button -->173<button class="icon-button">174 <svg><!-- search icon --></svg>175</button>176177<!-- ✅ GOOD: Accessible icon button with screen reader label -->178<button class="icon-button" aria-label="Search">179 <svg aria-hidden="true" focusable="false">180 <!-- search icon -->181 </svg>182</button>183```184185### Pattern 3: Form Design with Validation186187```tsx188import { useState, type ChangeEvent, type FormEvent } from "react";189190interface FormFieldProps {191 label: string;192 name: string;193 type?: "text" | "email" | "password";194 required?: boolean;195 error?: string;196 value: string;197 onChange: (event: ChangeEvent<HTMLInputElement>) => void;198}199200function FormField({201 label,202 name,203 type = "text",204 required = false,205 error,206 value,207 onChange,208}: FormFieldProps) {209 const errorId = `${name}-error`;210 const descriptionId = error ? errorId : undefined;211212 return (213 <div className="form-field">214 <label htmlFor={name} className="form-field__label">215 {label}216 {required && <span aria-hidden="true" className="required-mark"> *</span>}217 </label>218 <input219 id={name}220 name={name}221 type={type}222 value={value}223 onChange={onChange}224 required={required}225 aria-invalid={error ? "true" : undefined}226 aria-describedby={descriptionId}227 className={`form-field__input ${error ? "form-field__input--error" : ""}`}228 />229 {error && (230 <p id={errorId} className="form-field__error" role="alert">231 {error}232 </p>233 )}234 </div>235 );236}237238// Usage239function SignupForm() {240 const [email, setEmail] = useState("");241 const [error, setError] = useState("");242243 const handleSubmit = (event: FormEvent) => {244 event.preventDefault();245 if (!email.includes("@")) {246 setError("Please enter a valid email address");247 return;248 }249 setError("");250 // Submit form...251 };252253 return (254 <form onSubmit={handleSubmit} noValidate>255 <FormField256 label="Email Address"257 name="email"258 type="email"259 required260 error={error}261 value={email}262 onChange={(event) => setEmail(event.target.value)}263 />264 <button type="submit">Sign Up</button>265 </form>266 );267}268```269270---271272## Constraints273274### MUST DO275- Meet WCAG 2.1 AA minimum contrast: 4.5:1 for normal text, 3:1 for large text (18px+ bold or 24px+ regular) and UI component boundaries276- Provide visible focus indicators on all interactive elements using `:focus-visible` — never set `outline: none` without a replacement277- Support full keyboard-only navigation — every interactive element must be reachable and operable with Tab, Enter, Space, and Arrow keys278- Provide clear error messages for form validation that describe what went wrong and how to fix it279- Design mobile-first with progressive enhancement — test at 320px minimum viewport width280- Use semantic HTML elements (`<nav>`, `<main>`, `<article>`, `<button>`, `<a>`) over generic `<div>` and `<span>` with ARIA roles281282### MUST NOT DO283- Convey information using color alone — always pair color indicators with text labels, icons, or patterns284- Disable zoom or pinch-to-zoom — respect user viewport preferences with `viewport` meta tag285- Use `aria-hidden="true"` on focusable elements — hidden elements must not be interactive286- Remove focus outlines without providing an alternative visible focus indicator287- Use placeholder text as a substitute for visible labels on form inputs288- Design dismissable toast notifications that disappear before a screen reader can announce them289- Use generic alt text like "image" or "photo" — describe the content and function of each image290291---292293## Related Skills294295| Skill | Purpose |296|---|---|297| `css-architecture` | Organizing and structuring CSS for maintainable design systems |298| `design-systems` | Building and maintaining design system component libraries |299| `frontend-philosophy` | Visual design principles for distinctive, intentional UI |300| `react-view-transitions` | Implementing smooth page transitions with the View Transition API |301302---303304## Live References305306> Authoritative documentation links for this skill's domain. The model follows markdown links at load time to resolve external references and inline content.307308- [WCAG 2.1 Quick Reference](https://www.w3.org/WAI/WCAG21/quickref/)309- [WebAIM Contrast Checker](https://webaim.org/resources/contrastchecker/)310- [MDN: CSS Grid Layout](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout)311- [Inclusive Components](https://inclusive-components.design/)312- [A11y Project Checklist](https://www.a11yproject.com/checklist/)313- [Google Material Design Accessibility](https://material.io/design/usability/accessibility.html)314- [Smashing Magazine: Form Design Patterns](https://www.smashingmagazine.com/printed-books/form-design-patterns/)