Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Living wiki of UI design patterns and best practices built with Fumadocs, Next.js, and Base UI components.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: userinterface-wiki3description: UI/UX best practices for web interfaces. Use when reviewing animations, CSS, audio, typography, UX patterns, prefetching, or icon implementations. Covers 11 categories from animation principles to typography. Outputs file:line findings.4license: MIT5metadata:6author: raphael-salaja7version: "3.0.0"8---910# User Interface Wiki1112Comprehensive UI/UX best practices guide for web interfaces. Contains 152 rules across 12 categories, prioritized by impact to guide automated code review and generation.1314## When to Apply1516Reference these guidelines when:17- Implementing or reviewing animations (CSS transitions, Motion/Framer Motion)18- Choosing between springs, easing curves, or no animation19- Working with AnimatePresence and exit animations20- Writing CSS with pseudo-elements or View Transitions API21- Adding audio feedback or procedural sound to UI22- Building morphing icon components23- Animating container width/height with dynamic content24- Designing UI that respects cognitive psychology (Fitts's, Hick's, Miller's laws)25- Implementing predictive prefetching for perceived performance26- Setting up typography, OpenType features, or numeric formatting2728## Rule Categories by Priority2930| Priority | Category | Impact | Prefixes |31|----------|----------|--------|----------|32| 1 | Animation Principles | CRITICAL | `timing-`, `physics-`, `staging-` |33| 2 | Timing Functions | HIGH | `spring-`, `easing-`, `duration-`, `none-` |34| 3 | Exit Animations | HIGH | `exit-`, `presence-`, `mode-`, `nested-` |35| 4 | CSS Pseudo Elements | MEDIUM | `pseudo-`, `transition-`, `native-` |36| 5 | Audio Feedback | MEDIUM | `a11y-`, `appropriate-`, `impl-`, `weight-` |37| 6 | Sound Synthesis | MEDIUM | `context-`, `envelope-`, `design-`, `param-` |38| 7 | Morphing Icons | LOW | `morphing-` |39| 8 | Container Animation | MEDIUM | `container-` |40| 9 | Laws of UX | HIGH | `ux-` |41| 10 | Predictive Prefetching | MEDIUM | `prefetch-` |42| 11 | Typography | MEDIUM | `type-` |43| 12 | Visual Design | HIGH | `visual-` |4445## Quick Reference4647### 1. Animation Principles (CRITICAL)4849- `timing-under-300ms` - User animations must complete within 300ms50- `timing-consistent` - Similar elements use identical timing values51- `timing-no-entrance-context-menu` - Context menus: no entrance animation, exit only52- `easing-natural-decay` - Use exponential ramps for natural decay, not linear53- `easing-no-linear-motion` - Linear easing only for progress indicators54- `physics-active-state` - Interactive elements need :active scale transform55- `physics-subtle-deformation` - Squash/stretch in 0.95-1.05 range56- `physics-spring-for-overshoot` - Springs for overshoot-and-settle, not easing57- `physics-no-excessive-stagger` - Stagger delays under 50ms per item58- `staging-one-focal-point` - One prominent animation at a time59- `staging-dim-background` - Dim modal/dialog backgrounds60- `staging-z-index-hierarchy` - Animated elements respect z-index layers6162### 2. Timing Functions (HIGH)6364- `spring-for-gestures` - Gesture-driven motion (drag, flick) must use springs65- `spring-for-interruptible` - Interruptible motion must use springs66- `spring-preserves-velocity` - Springs preserve input energy on release67- `spring-params-balanced` - Avoid excessive oscillation in spring params68- `easing-for-state-change` - System state changes use easing curves69- `easing-entrance-ease-out` - Entrances use ease-out70- `easing-exit-ease-in` - Exits use ease-in71- `easing-transition-ease-in-out` - View transitions use ease-in-out72- `easing-linear-only-progress` - Linear only for progress/time representation73- `duration-press-hover` - Press/hover: 120-180ms74- `duration-small-state` - Small state changes: 180-260ms75- `duration-max-300ms` - User-initiated max 300ms76- `duration-shorten-before-curve` - Fix slow feel with shorter duration, not curve77- `none-high-frequency` - No animation for high-frequency interactions78- `none-keyboard-navigation` - Keyboard navigation instant, no animation79- `none-context-menu-entrance` - Context menus: no entrance, exit only8081### 3. Exit Animations (HIGH)8283- `exit-requires-wrapper` - Conditional motion elements need AnimatePresence wrapper84- `exit-prop-required` - Elements in AnimatePresence need exit prop85- `exit-key-required` - Dynamic lists need unique keys, not index86- `exit-matches-initial` - Exit mirrors initial for symmetry87- `presence-hook-in-child` - useIsPresent in child, not parent88- `presence-safe-to-remove` - Call safeToRemove after async cleanup89- `presence-disable-interactions` - Disable interactions on exiting elements90- `mode-wait-doubles-duration` - Mode "wait" doubles duration; halve timing91- `mode-sync-layout-conflict` - Mode "sync" causes layout conflicts92- `mode-pop-layout-for-lists` - Use popLayout for list reordering93- `nested-propagate-required` - Nested AnimatePresence needs propagate prop94- `nested-consistent-timing` - Coordinate parent-child exit durations9596### 4. CSS Pseudo Elements (MEDIUM)9798- `pseudo-content-required` - ::before/::after need content property99- `pseudo-over-dom-node` - Pseudo-elements over extra DOM nodes for decoration100- `pseudo-position-relative-parent` - Parent needs position: relative101- `pseudo-z-index-layering` - Z-index for correct pseudo-element layering102- `pseudo-hit-target-expansion` - Negative inset for larger hit targets103- `pseudo-marker-styling` - Use ::marker for custom list bullet styles104- `pseudo-first-line-styling` - Use ::first-line for typographic treatments105- `transition-name-required` - View transitions need view-transition-name106- `transition-name-unique` - Each transition name unique during transition107- `transition-name-cleanup` - Remove transition name after completion108- `transition-over-js-library` - Prefer View Transitions API over JS libraries109- `transition-style-pseudo-elements` - Style ::view-transition-group for custom animations110- `native-backdrop-styling` - Use ::backdrop for dialog backgrounds111- `native-placeholder-styling` - Use ::placeholder for input styling112- `native-selection-styling` - Use ::selection for text selection styling113114### 5. Audio Feedback (MEDIUM)115116- `a11y-visual-equivalent` - Every sound must have a visual equivalent117- `a11y-toggle-setting` - Provide toggle to disable sounds118- `a11y-reduced-motion-check` - Respect prefers-reduced-motion for sound119- `a11y-volume-control` - Allow independent volume adjustment120- `appropriate-no-high-frequency` - No sound on typing or keyboard nav121- `appropriate-confirmations-only` - Sound for payments, uploads, submissions122- `appropriate-errors-warnings` - Sound for errors that can't be overlooked123- `appropriate-no-decorative` - No sound on hover or decorative moments124- `appropriate-no-punishing` - Inform, don't punish with harsh sounds125- `impl-preload-audio` - Preload audio files to avoid delay126- `impl-default-subtle` - Default volume subtle (0.3), not loud127- `impl-reset-current-time` - Reset currentTime before replay128- `weight-match-action` - Sound weight matches action importance129- `weight-duration-matches-action` - Sound duration matches action duration130131### 6. Sound Synthesis (MEDIUM)132133- `context-reuse-single` - Reuse single AudioContext, don't create per sound134- `context-resume-suspended` - Resume suspended AudioContext before playing135- `context-cleanup-nodes` - Disconnect audio nodes after playback136- `envelope-exponential-decay` - Exponential ramps for natural decay137- `envelope-no-zero-target` - Exponential ramps target 0.001, not 0138- `envelope-set-initial-value` - Set initial value before ramping139- `design-noise-for-percussion` - Filtered noise for clicks/taps140- `design-oscillator-for-tonal` - Oscillators with pitch sweep for tonal sounds141- `design-filter-for-character` - Bandpass filter to shape percussive sounds142- `param-click-duration` - Click sounds: 5-15ms duration143- `param-filter-frequency-range` - Click filter: 3000-6000Hz144- `param-reasonable-gain` - Gain under 1.0 to prevent clipping145- `param-q-value-range` - Filter Q: 2-5 for focused but natural146147### 7. Morphing Icons (LOW)148149- `morphing-three-lines` - Every icon uses exactly 3 SVG lines150- `morphing-use-collapsed` - Unused lines use collapsed constant151- `morphing-consistent-viewbox` - All icons share same viewBox (14x14)152- `morphing-group-variants` - Rotational variants share group and base lines153- `morphing-spring-rotation` - Spring physics for grouped icon rotation154- `morphing-reduced-motion` - Respect prefers-reduced-motion155- `morphing-jump-non-grouped` - Instant rotation jump between non-grouped icons156- `morphing-strokelinecap-round` - Round stroke line caps157- `morphing-aria-hidden` - Icon SVGs are aria-hidden158159### 8. Container Animation (MEDIUM)160161- `container-two-div-pattern` - Outer animated div, inner measured div; never same element162- `container-guard-initial-zero` - Guard bounds === 0 on initial render, fall back to "auto"163- `container-use-resize-observer` - Use ResizeObserver for measurement, not getBoundingClientRect164- `container-overflow-hidden` - Set overflow: hidden on animated container during transitions165- `container-no-excessive-use` - Use sparingly: buttons, accordions, interactive elements166- `container-callback-ref` - Use callback ref (not useRef) for measurement hooks167- `container-transition-delay` - Add small delay for natural catching-up feel168169### 9. Laws of UX (HIGH)170171- `ux-fitts-target-size` - Size interactive targets for easy clicking (min 32px)172- `ux-fitts-hit-area` - Expand hit areas with invisible padding or pseudo-elements173- `ux-hicks-minimize-choices` - Minimize choices to reduce decision time174- `ux-millers-chunking` - Chunk data into groups of 5-9 for scannability175- `ux-doherty-under-400ms` - Respond within 400ms to feel instant176- `ux-doherty-perceived-speed` - Fake speed with skeletons, optimistic UI, progress indicators177- `ux-postels-accept-messy-input` - Accept messy input, output clean data178- `ux-progressive-disclosure` - Show what matters now, reveal complexity later179- `ux-jakobs-familiar-patterns` - Use familiar UI patterns users know from other sites180- `ux-aesthetic-usability` - Visual polish increases perceived usability181- `ux-proximity-grouping` - Group related elements spatially with tighter spacing182- `ux-similarity-consistency` - Similar elements should look alike183- `ux-common-region-boundaries` - Use boundaries to group related content184- `ux-von-restorff-emphasis` - Make important elements visually distinct185- `ux-serial-position` - Place key items first or last in sequences186- `ux-peak-end-finish-strong` - End experiences with clear success states187- `ux-teslers-complexity` - Move complexity to the system, not the user188- `ux-goal-gradient-progress` - Show progress toward completion189- `ux-zeigarnik-show-incomplete` - Show incomplete state to drive completion190- `ux-pragnanz-simplify` - Simplify complex visuals into clear forms191- `ux-pareto-prioritize-features` - Prioritize the critical 20% of features192- `ux-cognitive-load-reduce` - Minimize extraneous cognitive load193- `ux-uniform-connectedness` - Visually connect related elements with lines or frames194195### 10. Predictive Prefetching (MEDIUM)196197- `prefetch-trajectory-over-hover` - Trajectory prediction over hover; reclaims 100-200ms198- `prefetch-not-everything` - Prefetch by intent, not viewport; avoid wasted bandwidth199- `prefetch-hit-slop` - Use hitSlop to trigger predictions earlier200- `prefetch-touch-fallback` - Fall back gracefully on touch devices (no cursor)201- `prefetch-keyboard-tab` - Prefetch on keyboard navigation when focus approaches202- `prefetch-use-selectively` - Use predictive prefetching where latency is noticeable203204### 11. Typography (MEDIUM)205206- `type-tabular-nums-for-data` - Tabular numbers for columns, dashboards, pricing207- `type-oldstyle-nums-for-prose` - Oldstyle numbers blend into body text208- `type-slashed-zero` - Slashed zero in code-adjacent UIs209- `type-opentype-contextual-alternates` - Keep calt enabled for contextual glyph adjustment210- `type-disambiguation-stylistic-set` - Enable ss02 to distinguish I/l/1 and 0/O211- `type-optical-sizing-auto` - Leave font-optical-sizing auto for size-adaptive glyphs212- `type-antialiased-on-retina` - Antialiased font smoothing on retina displays213- `type-text-wrap-balance-headings` - text-wrap: balance on headings for even lines214- `type-underline-offset` - Offset underlines below descenders215- `type-no-font-synthesis` - Disable font-synthesis to prevent faux bold/italic216- `type-font-display-swap` - Use font-display: swap to avoid invisible text during load217- `type-variable-weight-continuous` - Use continuous weight values (100-900) with variable fonts218- `type-text-wrap-pretty` - text-wrap: pretty for body text to reduce orphans219- `type-justify-with-hyphens` - Pair text-align: justify with hyphens: auto220- `type-letter-spacing-uppercase` - Add letter-spacing to uppercase and small-caps text221- `type-proper-fractions` - Use diagonal-fractions for proper typographic fractions222223### 12. Visual Design (HIGH)224225- `visual-concentric-radius` - Inner radius = outer radius minus padding for nested elements226- `visual-layered-shadows` - Layer multiple shadows for realistic depth227- `visual-shadow-direction` - All shadows share same offset direction (single light source)228- `visual-no-pure-black-shadow` - Use neutral colors, not pure black, for shadows229- `visual-shadow-matches-elevation` - Shadow size indicates elevation in consistent scale230- `visual-animate-shadow-pseudo` - Animate shadow via pseudo-element opacity for performance231- `visual-consistent-spacing-scale` - Use a consistent spacing scale, not arbitrary values232- `visual-border-alpha-colors` - Semi-transparent borders adapt to any background233- `visual-button-shadow-anatomy` - Six-layer shadow anatomy for polished buttons234235## How to Use236237Read individual rule files for detailed explanations and code examples:238239```240rules/timing-under-300ms.md241rules/spring-for-gestures.md242rules/ux-doherty-under-400ms.md243rules/type-tabular-nums-for-data.md244```245246Each rule file contains:247- Brief explanation of why it matters248- Incorrect code example with explanation249- Correct code example with explanation250251## Full Compiled Document252253For the complete guide with all rules expanded: `AGENTS.md`254