Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Design engineering principles for polished UI details: concentric border radius, interruptible animations, shadows, and font smoothing.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
performance.md
1# Performance23Transition specificity and GPU compositing hints.45## Transition Only What Changes67Never use `transition: all` or Tailwind's `transition` shorthand (which maps to `transition-property: all`). Always specify the exact properties that change.89### Why1011- `transition: all` forces the browser to watch every property for changes12- Causes unexpected transitions on properties you didn't intend to animate (colors, padding, shadows)13- Prevents browser optimizations1415### CSS Example1617```css18/* Good — only transition what changes */19.button {20transition-property: scale, background-color;21transition-duration: 150ms;22transition-timing-function: ease-out;23}2425/* Bad — transition everything */26.button {27transition: all 150ms ease-out;28}29```3031### Tailwind3233```tsx34// Good — explicit properties35<button className="transition-[scale,background-color] duration-150 ease-out">3637// Bad — transition all38<button className="transition duration-150 ease-out">39```4041### Tailwind `transition-transform` Note4243`transition-transform` in Tailwind maps to `transition-property: transform, translate, scale, rotate` — it covers all transform-related properties, not just `transform`. Use this when you're only animating transforms. For multiple non-transform properties, use the bracket syntax: `transition-[scale,opacity,filter]`.4445## Use `will-change` Sparingly4647`will-change` hints the browser to pre-promote an element to its own GPU compositing layer. Without it, the browser promotes the element only when the animation starts — that one-time layer promotion can cause a micro-stutter on the first frame.4849This particularly helps when an element is changing `scale`, `rotation`, or moving around with `transform`. For other properties, it doesn't help much — the browser can't composite them on the GPU anyway.5051### Rules5253```css54/* Good — specific property that benefits from GPU compositing */55.animated-card {56will-change: transform;57}5859/* Good — multiple compositor-friendly properties */60.animated-card {61will-change: transform, opacity;62}6364/* Bad — never use will-change: all */65.animated-card {66will-change: all;67}6869/* Bad — properties that can't be GPU-composited anyway */70.animated-card {71will-change: background-color, padding;72}73```7475### Useful Properties7677| Property | GPU-compositable | Worth using `will-change` |78| --- | --- | --- |79| `transform` | Yes | Yes |80| `opacity` | Yes | Yes |81| `filter` (blur, brightness) | Yes | Yes |82| `clip-path` | Yes | Yes |83| `top`, `left`, `width`, `height` | No | No |84| `background`, `border`, `color` | No | No |8586### When to Skip8788Modern browsers are already good at optimizing on their own. Only add `will-change` when you notice first-frame stutter — Safari in particular benefits from it. Don't add it preemptively to every animated element; each extra compositing layer costs memory.89