Tactile UI
Enforce concrete visual, CSS, and motion rules on every frontend UI change.
Step 0: Surface Triage (Motion Restraint Gate)
Classify the target surface before adding any animation or transition:
| Surface Type | Examples | Default Motion Policy |
|---|---|---|
| Utilitarian / High-Frequency | Admin panels, data tables, dense forms, settings, command palettes, keyboard-driven tools | Zero motion or instant CSS (<=120ms, opacity/transform only). Never add spring physics, bounce, or <ViewTransition> route morphs unless explicitly requested. |
| Expressive / Consumer | Marketing pages, onboarding, media galleries, mobile-style bottom sheets, drawers, carousels | Use 1:1 pointer tracking, interruptible physics springs, and spatial <ViewTransition> choreography where it clarifies continuity. |
Rule of frequency: the more often an action is repeated, the less it should animate.
Step 1: Environment & Compatibility Check
Before importing libraries or using modern CSS primitives:
- Inspect
package.json:- React version: Only import
<ViewTransition>oraddTransitionTypefromreacton React>=19.3(or canary/Next.js withexperimental.viewTransition). On React18or19.0–19.2, use CSS transitions or feature-detecteddocument.startViewTransition?.(...). - Motion library: Only import
motion/motion/reactif already installed inpackage.json(or approved); otherwise use CSS orrequestAnimationFrame. - Existing design system: Preserve the project's existing tokens, fonts, and palette unless building from scratch or explicitly redesigning.
- React version: Only import
- Guard modern CSS with
@supportsor fallback declarations:- Wrap
text-box-trimin@supports (text-box-trim: trim-both). - Wrap
interpolate-size: allow-keywordsin@supports (interpolate-size: allow-keywords)with agrid-template-rows: 0fr -> 1frfallback. - Pair
oklch(...)andin oklchcolors/gradients with an earlier sRGB/hex fallback declaration (or@supports (color: oklch(0 0 0))). - Pair
100dvhwith100vh; guardfield-sizing: content,calc-size(), and CSS Anchor Positioning cleanly.
- Wrap
Choosing the Right Motion Primitive
| Use Case | Tool / Primitive | Why |
|---|---|---|
| Utilitarian UI & dense controls | None or instant CSS (<=120ms, transform/opacity) | Zero latency penalty on repeat actions |
| Micro-interactions & reveals | CSS (transform, opacity; grid-template-rows or guarded interpolate-size for height) | Zero JS overhead, <300ms, compositor-friendly |
| Gesture-driven UI (drags, sheets, carousels, flicks) | Physics Springs + Pointer Events (motion / rAF) | Interruptible mid-flight, preserves release velocity |
Route, shared-element & list transitions (React 19.3+) | <ViewTransition> + addTransitionType | Native snapshots with document / CSS fallback |
Core Workflow
- Triage surface & check environment (Steps 0 and 1 above).
- Build layout & CSS defensively — Keep high-frequency animations on
transformandopacity(nevertop/left/width/height/margin/padding), start entrances atscale(0.97)+opacity: 0(neverscale(0)/scale: 0), useminmax(0, 1fr),overflow: clip,overscroll-behavior: contain, and@supportsfallbacks. - Make expressive gestures physical & interruptible — Respond on
pointerdown, track 1:1 withsetPointerCapture, clean up onpointercancelandlostpointercapture, animate from the live presentation value, pass release velocity into physics springs (stiffness/damping/mass, neverduration/bouncealongsidevelocity), target damping ratio1.0(~0.8only for momentum flicks), and rubber-band boundaries. - Enforce reduced motion & spatial consistency — Include
@media (prefers-reduced-motion: reduce)(oruseReducedMotion/<MotionConfig reducedMotion="user">), exit panels along their entry vector, and settransform-originon trigger-anchored popovers.
Pre-Ship Verification Gate
- Run the automated audit script (mandatory before finishing) on modified UI files or the active git working tree:
Fix everynode <skill-dir>/scripts/audit-ui.mjs --changed # or target specific paths: node <skill-dir>/scripts/audit-ui.mjs path/to/Component.tsx path/to/styles.csserror(layout-animation,missing-reduced-motion,motion-velocity-ignored,scale-zero-entrance) before reporting completion. Reviewunguarded-bleeding-edge-csswarnings and add@supportsor sRGB fallbacks where non-Chromium targets matter. - Verify runtime behavior that static analysis cannot inspect:
- Interruptible mid-flight: Sheets, drawers, and carousels re-grab mid-spring from their live on-screen position without snapping or locking input.
- Safe drag cancel:
pointercancel/lostpointercaptureresets drag state cleanly without wedging subsequent drags. - Existing system preserved: Existing product tokens and fonts remain intact unless redesigning or starting greenfield.
Reference Index (Conditional Loading)
Load only the 1–2 reference files needed for the task at hand. Do not load all six files for a targeted CSS, button, or form change.
| Load ONLY when the task involves... | Reference |
|---|---|
| Greenfield layout structure, card grids, visual hierarchy, AI-cliché audits, or UI microcopy | Anti-Slop Layout & Copy |
CSS Grid/Flex traps, subgrid, overflow: clip, @container, :has(), PropFLIP, or viewport resilience | Defensive CSS & Engineering Craft |
OKLCH scales/gradients, text-box-trim, type scale, optical tracking/leading, or font selection | CSS & Typography |
| Drag gestures, bottom sheets, carousels, physics springs, velocity projection, rubber-banding, or glass chrome | Fluid Physics & Gestures |
React 19.3+ <ViewTransition>, addTransitionType, route/shared-element choreography, or VT CSS recipes | React View Transitions |
| Accent/theme palette creation, password/form validation UX, or product/App Store screenshots | Color, Forms & Product |