UI/UX Audit & Implementation
Methodology — Do This First
Before making any changes:
Explore the site fully via Playwright — navigate every view, interact
with every control, inspect computed styles, take screenshots. Click through
every reachable state. Include empty/zero-data states.
Infer the UI personality from what exists — observe border-radius, font
choices, color palette, and copy tone. Classify as elegant (serif, sharp
corners, restrained palette), playful (rounded, saturated, casual copy), or
neutral (sans-serif, medium radius, professional). Flag inconsistencies —
e.g. playful rounded buttons with formal serif headings.
Fix issues immediately by injecting CSS and JS via Playwright. Take
before/after screenshots to confirm improvements.
Re-audit after each round of fixes — new issues surface once earlier
ones are resolved. Keep iterating until the design is coherent and polished.
Update the codebase to make changes permanent. Do not introduce bloat
to the CSS — reuse or refactor what exists.
Affordances & Signifiers
- Group related controls in containers — cards, panels, bordered regions.
- Toggles must live inside a container, never floating.
- Inactive/disabled elements:
opacity ≤ 0.4, cursor: not-allowed.
- Every non-obvious control needs a tooltip on hover.
- Controls must look like what they do — buttons raised, inputs clearly fillable.
Visual Hierarchy
- No flat spreadsheet layouts — every section needs a clear primary element.
- Size, position, and color must work together to direct the eye.
- Most important action or information: largest, highest contrast, most prominent.
- Supporting content should recede — smaller, lighter, lower contrast.
Relationships & Composition
Button Hierarchy
When multiple actions compete, only one gets primary treatment:
| Role |
Style |
| Primary |
Solid fill, brand color, prominent |
| Secondary |
Outline or muted fill |
| Tertiary |
Ghost / text-only link style |
| Destructive |
Tertiary or secondary — never red primary alongside other primaries |
- If "Delete", "Edit", and "Publish" all look equally bold, the user can't
tell what the intended action is. Demote everything except the one thing you
want the user to do.
Label Elimination
- Format is the label —
john@example.com doesn't need an "Email:" prefix.
Dates, phone numbers, currency, and URLs are self-evident.
- Combine label into value — instead of "In stock: Yes", say "In stock" as
styled text or a badge.
- De-emphasize labels — when labels are necessary, make them smaller, lighter
weight, and lower contrast than their values.
- Exception: dense specification/comparison tables benefit from labels for
scannability.
Spacing as Grouping
- Elements that belong together must be closer to each other than to
unrelated elements — title tight to its body, generous gap before the next
section.
- Ambiguous equidistant spacing makes relationships unclear. Audit title-to-body
vs. body-to-next-title distances. Audit icon-to-label gaps vs. label-to-label
gaps in lists.
Border Alternatives
- Prefer box-shadow, background color differences, and extra spacing
over
border: 1px solid. Borders between every element create visual clutter.
- Borders are fine for inputs and explicit dividers, but a list of cards
separated only by gap + shadow reads cleaner than bordered rows.
Grids, Layout & Spacing
- All spacing must be multiples of 4px — audit margins, paddings, gaps.
- Whitespace generous enough that content breathes.
- Consistent alignment — no orphaned elements, no ragged gutters.
- Related elements tight together, unrelated elements separated generously.
Typography & Font Sizing
- Consistent type scale — flag arbitrary font sizes not on the scale.
- Weight and size together signal hierarchy — not one without the other.
- Body
line-height: 1.4–1.6× font size. Large headings can go tighter (~1.1–1.2).
- Wide content columns need taller line-height (
1.6–1.8); narrow columns can
use shorter (1.4–1.5).
- Max 2 typefaces, max 3 weights in active use.
- Letter spacing: tighten large headlines (
letter-spacing: -0.02em to
-0.05em). Loosen all-caps text (letter-spacing: 0.05em+).
Content Constraints
- Line length: paragraphs should be 45–75 characters wide. Audit with
ch units or measure rendered text. Applies even when the element shares a
row with images or sidebars.
- Don't fill the whole screen: content areas need a
max-width — just
because the nav is full-width doesn't mean the body should be. A checkout
page or article at 600–800px centered reads far better than stretched to 1400px.
- Think in columns: when a single column feels too wide on desktop but works
on mobile, consider splitting into 2–3 columns rather than just making it wider.
- Scale disproportionately: when adapting components across breakpoints,
fine-tune padding, font-size, and icon-size independently — don't scale all
properties by the same factor.
Color Theory
- One primary brand color with a derived ramp — lighter for backgrounds,
darker for text and accents.
- Semantic colors used consistently and only for their meaning:
| Color |
Meaning |
| Blue |
Info |
| Green |
Success |
| Red |
Error |
| Yellow |
Warning |
- All text must pass WCAG AA contrast —
4.5:1 for body, 3:1 for large text.
- Minimal hue count — neutral base + primary + semantics only.
Shadows & Depth
- Raised interactive elements need
box-shadow — buttons, cards, dropdowns, modals.
- Low opacity, primary-tinted or neutral dark — never pure black.
- Elevation levels: subtle lift for buttons, moderate for cards, strong for modals.
- Flat elements stay flat — don't shadow everything.
Icons & Buttons
- Icon size matches
line-height of adjacent text — verify with getComputedStyle.
- Icon-to-label gap:
4–6px.
- Button padding: horizontal ≈ 2× vertical — e.g.
8px 16px or 12px 24px.
- Minimum click target:
44×44px.
Feedback & States
Every interactive element must have all required states:
| Element |
States |
| Buttons |
default / hover / active / disabled / loading |
| Inputs |
default / focus / error (red border + message) / success |
- Every meaningful user action must produce a visible response within 300ms.
- Inject missing states via
:hover, :focus, :active, :disabled selectors.
Micro-Interactions
- High-value actions get motion — confirmation chips, animated checkmarks, e.g.
labels morphing to "Saved ✓", copy button should confirm copy happened, etc.
- Timing:
150–300ms, ease-out curves.
- Test live via
page.evaluate() with CSS transitions and animations.
Overlays & Image Treatments
- Text over images: linear gradients or progressive blur — never flat rectangles.
- Text contrast against overlay must pass
4.5:1.
- Inject gradient scrims or
backdrop-filter: blur() where missing.
Empty States
- Every content-dependent view must have an intentional empty state — not just
a blank page.
- Show a prominent CTA ("+ Add contact", "Create your first project") as the
main focus.
- Hide irrelevant chrome: tabs, filters, sort controls, and bulk actions
should be hidden or disabled when there's zero content. Showing them empty
creates confusion.
- An illustration or icon reinforces the empty state message and prevents the
page from feeling broken.
User-Uploaded Content
- Control shape and size: center user images in fixed-dimension containers and
crop overflow. Never let aspect ratios break your layout.
- Prevent background bleed on avatars and thumbnails — when a user uploads an
image with a white or light background, it bleeds into your page background.
Anti-patterns
- Floating controls without a containing group
- Flat layouts with no visual hierarchy
- Spacing not on the 4px grid
- Text failing WCAG AA contrast ratios
- Missing hover/focus/active/disabled states
- Pure black box-shadows
- Arbitrary font sizes outside the type scale
- Click targets smaller than 44×44px
- Borders everywhere — lists, cards, and sections separated by
border
instead of shadow, background, or spacing
- Content stretching full viewport — paragraphs or forms at 100% width with
no
max-width constraint
- Paragraph lines > 75 characters — hard to read; constrain with
max-width
in ch or px
- Multiple equally-styled primary buttons — competing CTAs with no clear
hierarchy
- Redundant labels on self-evident data — "Email: user@example.com",
"Date: March 5, 2025"
- Empty views with no CTA — blank pages with no guidance on what to do next
- User-uploaded images without dimension control — breaking layout or
bleeding into page background
- Personality inconsistency — mixing sharp corners with bubbly fonts, or
playful colors with formal copy
CSS Techniques — Non-Obvious Patterns
Prevent avatar/thumbnail background bleed
.avatar {
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
/* OR */
border: 1px solid rgba(0, 0, 0, 0.05);
}
Overlap elements for depth (hero → content)
.search-panel {
position: relative;
margin-top: -60px; /* pulls up into the hero section */
}
Two-shadow combination for realistic depth
.card {
box-shadow:
0 1px 3px rgba(0, 0, 0, 0.12), /* tight, dark — defines edge */
0 8px 24px rgba(0, 0, 0, 0.08); /* wide, soft — ambient lift */
}
Accent border for instant personality
.card { border-top: 4px solid var(--color-primary); }
.alert { border-left: 4px solid var(--color-warning); }
1---2name: ui-ux3description: Use when conducting UI/UX audits, fixing visual or interaction design issues, or improving the look and feel of a web application. Triggers include: any request to audit a UI, improve styling, fix layout or spacing problems, enhance accessibility, add hover/focus states, or polish a frontend design. Also use when the user mentions Playwright alongside design, CSS, or visual quality.4---56# UI/UX Audit & Implementation78## Methodology — Do This First910Before making any changes:11121. **Explore the site fully** via Playwright — navigate every view, interact13 with every control, inspect computed styles, take screenshots. Click through14 every reachable state. Include empty/zero-data states.15162. **Infer the UI personality** from what exists — observe border-radius, font17 choices, color palette, and copy tone. Classify as elegant (serif, sharp18 corners, restrained palette), playful (rounded, saturated, casual copy), or19 neutral (sans-serif, medium radius, professional). Flag inconsistencies —20 e.g. playful rounded buttons with formal serif headings.21223. **Fix issues immediately** by injecting CSS and JS via Playwright. Take23 before/after screenshots to confirm improvements.24254. **Re-audit after each round** of fixes — new issues surface once earlier26 ones are resolved. Keep iterating until the design is coherent and polished.27285. **Update the codebase** to make changes permanent. Do not introduce bloat29 to the CSS — reuse or refactor what exists.3031---3233## Affordances & Signifiers3435- Group related controls in containers — cards, panels, bordered regions.36- Toggles must live inside a container, never floating.37- Inactive/disabled elements: `opacity ≤ 0.4`, `cursor: not-allowed`.38- Every non-obvious control needs a tooltip on hover.39- Controls must look like what they do — buttons raised, inputs clearly fillable.4041---4243## Visual Hierarchy4445- No flat spreadsheet layouts — every section needs a clear primary element.46- Size, position, and color must work together to direct the eye.47- Most important action or information: largest, highest contrast, most prominent.48- Supporting content should recede — smaller, lighter, lower contrast.4950---5152## Relationships & Composition5354### Button Hierarchy5556When multiple actions compete, only **one** gets primary treatment:5758| Role | Style |59|-------------|-----------------------------------------------|60| Primary | Solid fill, brand color, prominent |61| Secondary | Outline or muted fill |62| Tertiary | Ghost / text-only link style |63| Destructive | Tertiary or secondary — never red primary alongside other primaries |6465- If "Delete", "Edit", and "Publish" all look equally bold, the user can't66 tell what the intended action is. Demote everything except the one thing you67 want the user to do.6869### Label Elimination7071- **Format is the label** — `john@example.com` doesn't need an "Email:" prefix.72 Dates, phone numbers, currency, and URLs are self-evident.73- **Combine label into value** — instead of "In stock: Yes", say "In stock" as74 styled text or a badge.75- **De-emphasize labels** — when labels are necessary, make them smaller, lighter76 weight, and lower contrast than their values.77- **Exception**: dense specification/comparison tables benefit from labels for78 scannability.7980### Spacing as Grouping8182- Elements that belong together must be **closer** to each other than to83 unrelated elements — title tight to its body, generous gap before the next84 section.85- Ambiguous equidistant spacing makes relationships unclear. Audit title-to-body86 vs. body-to-next-title distances. Audit icon-to-label gaps vs. label-to-label87 gaps in lists.8889### Border Alternatives9091- Prefer **box-shadow**, **background color differences**, and **extra spacing**92 over `border: 1px solid`. Borders between every element create visual clutter.93- Borders are fine for inputs and explicit dividers, but a list of cards94 separated only by gap + shadow reads cleaner than bordered rows.9596---9798## Grids, Layout & Spacing99100- All spacing must be multiples of **4px** — audit margins, paddings, gaps.101- Whitespace generous enough that content breathes.102- Consistent alignment — no orphaned elements, no ragged gutters.103- Related elements tight together, unrelated elements separated generously.104105---106107## Typography & Font Sizing108109- Consistent type scale — flag arbitrary font sizes not on the scale.110- Weight and size together signal hierarchy — not one without the other.111- Body `line-height`: 1.4–1.6× font size. Large headings can go tighter (~1.1–1.2).112- Wide content columns need taller line-height (~1.6–1.8); narrow columns can113 use shorter (~1.4–1.5).114- Max 2 typefaces, max 3 weights in active use.115- **Letter spacing**: tighten large headlines (`letter-spacing: -0.02em` to116 `-0.05em`). Loosen all-caps text (`letter-spacing: 0.05em`+).117118---119120## Content Constraints121122- **Line length**: paragraphs should be **45–75 characters** wide. Audit with123 `ch` units or measure rendered text. Applies even when the element shares a124 row with images or sidebars.125- **Don't fill the whole screen**: content areas need a `max-width` — just126 because the nav is full-width doesn't mean the body should be. A checkout127 page or article at 600–800px centered reads far better than stretched to 1400px.128- **Think in columns**: when a single column feels too wide on desktop but works129 on mobile, consider splitting into 2–3 columns rather than just making it wider.130- **Scale disproportionately**: when adapting components across breakpoints,131 fine-tune padding, font-size, and icon-size independently — don't scale all132 properties by the same factor.133134---135136## Color Theory137138- One primary brand color with a derived ramp — lighter for backgrounds,139 darker for text and accents.140- Semantic colors used consistently and only for their meaning:141142| Color | Meaning |143|--------|---------|144| Blue | Info |145| Green | Success |146| Red | Error |147| Yellow | Warning |148149- All text must pass **WCAG AA** contrast — `4.5:1` for body, `3:1` for large text.150- Minimal hue count — neutral base + primary + semantics only.151152---153154## Shadows & Depth155156- Raised interactive elements need `box-shadow` — buttons, cards, dropdowns, modals.157- Low opacity, primary-tinted or neutral dark — never pure black.158- Elevation levels: subtle lift for buttons, moderate for cards, strong for modals.159- Flat elements stay flat — don't shadow everything.160161---162163## Icons & Buttons164165- Icon size matches `line-height` of adjacent text — verify with `getComputedStyle`.166- Icon-to-label gap: `4–6px`.167- Button padding: horizontal ≈ 2× vertical — e.g. `8px 16px` or `12px 24px`.168- Minimum click target: `44×44px`.169170---171172## Feedback & States173174Every interactive element must have all required states:175176| Element | States |177|---------|-----------------------------------------------------|178| Buttons | default / hover / active / disabled / loading |179| Inputs | default / focus / error (red border + message) / success |180181- Every meaningful user action must produce a visible response within **300ms**.182- Inject missing states via `:hover`, `:focus`, `:active`, `:disabled` selectors.183184---185186## Micro-Interactions187188- High-value actions get motion — confirmation chips, animated checkmarks, e.g.189 labels morphing to "Saved ✓", copy button should confirm copy happened, etc.190- Timing: `150–300ms`, `ease-out` curves.191- Test live via `page.evaluate()` with CSS transitions and animations.192193---194195## Overlays & Image Treatments196197- Text over images: linear gradients or progressive blur — never flat rectangles.198- Text contrast against overlay must pass `4.5:1`.199- Inject gradient scrims or `backdrop-filter: blur()` where missing.200201---202203## Empty States204205- Every content-dependent view must have an intentional empty state — not just206 a blank page.207- Show a prominent CTA ("+ Add contact", "Create your first project") as the208 main focus.209- **Hide irrelevant chrome**: tabs, filters, sort controls, and bulk actions210 should be hidden or disabled when there's zero content. Showing them empty211 creates confusion.212- An illustration or icon reinforces the empty state message and prevents the213 page from feeling broken.214215---216217## User-Uploaded Content218219- Control shape and size: center user images in fixed-dimension containers and220 crop overflow. Never let aspect ratios break your layout.221- Prevent background bleed on avatars and thumbnails — when a user uploads an222 image with a white or light background, it bleeds into your page background.223224---225226## Anti-patterns227228- Floating controls without a containing group229- Flat layouts with no visual hierarchy230- Spacing not on the 4px grid231- Text failing WCAG AA contrast ratios232- Missing hover/focus/active/disabled states233- Pure black box-shadows234- Arbitrary font sizes outside the type scale235- Click targets smaller than 44×44px236- **Borders everywhere** — lists, cards, and sections separated by `border`237 instead of shadow, background, or spacing238- **Content stretching full viewport** — paragraphs or forms at 100% width with239 no `max-width` constraint240- **Paragraph lines > 75 characters** — hard to read; constrain with `max-width`241 in `ch` or `px`242- **Multiple equally-styled primary buttons** — competing CTAs with no clear243 hierarchy244- **Redundant labels** on self-evident data — "Email: user@example.com",245 "Date: March 5, 2025"246- **Empty views with no CTA** — blank pages with no guidance on what to do next247- **User-uploaded images without dimension control** — breaking layout or248 bleeding into page background249- **Personality inconsistency** — mixing sharp corners with bubbly fonts, or250 playful colors with formal copy251252---253254## CSS Techniques — Non-Obvious Patterns255256### Prevent avatar/thumbnail background bleed257258```css259.avatar {260 box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);261 /* OR */262 border: 1px solid rgba(0, 0, 0, 0.05);263}264```265266### Overlap elements for depth (hero → content)267268```css269.search-panel {270 position: relative;271 margin-top: -60px; /* pulls up into the hero section */272}273```274275### Two-shadow combination for realistic depth276277```css278.card {279 box-shadow:280 0 1px 3px rgba(0, 0, 0, 0.12), /* tight, dark — defines edge */281 0 8px 24px rgba(0, 0, 0, 0.08); /* wide, soft — ambient lift */282}283```284285### Accent border for instant personality286287```css288.card { border-top: 4px solid var(--color-primary); }289.alert { border-left: 4px solid var(--color-warning); }290```