@luci-dev/skills 0.0.0-stage → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (389) hide show
  1. package/dist/benchmark.d.ts +48 -0
  2. package/dist/benchmark.d.ts.map +1 -0
  3. package/dist/benchmark.js +84 -0
  4. package/dist/benchmark.js.map +1 -0
  5. package/dist/discovery.d.ts +105 -0
  6. package/dist/discovery.d.ts.map +1 -0
  7. package/dist/discovery.js +271 -0
  8. package/dist/discovery.js.map +1 -0
  9. package/dist/drafts.d.ts +20 -0
  10. package/dist/drafts.d.ts.map +1 -0
  11. package/dist/drafts.js +57 -0
  12. package/dist/drafts.js.map +1 -0
  13. package/dist/github.d.ts +49 -0
  14. package/dist/github.d.ts.map +1 -0
  15. package/dist/github.js +93 -0
  16. package/dist/github.js.map +1 -0
  17. package/dist/import.d.ts +80 -0
  18. package/dist/import.d.ts.map +1 -0
  19. package/dist/import.js +286 -0
  20. package/dist/import.js.map +1 -0
  21. package/dist/index.d.ts +17 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +17 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/licenses.d.ts +30 -0
  26. package/dist/licenses.d.ts.map +1 -0
  27. package/dist/licenses.js +116 -0
  28. package/dist/licenses.js.map +1 -0
  29. package/dist/linter.d.ts +35 -0
  30. package/dist/linter.d.ts.map +1 -0
  31. package/dist/linter.js +262 -0
  32. package/dist/linter.js.map +1 -0
  33. package/dist/lss.d.ts +74 -0
  34. package/dist/lss.d.ts.map +1 -0
  35. package/dist/lss.js +273 -0
  36. package/dist/lss.js.map +1 -0
  37. package/dist/orchestrator.d.ts +164 -0
  38. package/dist/orchestrator.d.ts.map +1 -0
  39. package/dist/orchestrator.js +370 -0
  40. package/dist/orchestrator.js.map +1 -0
  41. package/dist/packs.d.ts +50 -0
  42. package/dist/packs.d.ts.map +1 -0
  43. package/dist/packs.js +166 -0
  44. package/dist/packs.js.map +1 -0
  45. package/dist/preferences.d.ts +18 -0
  46. package/dist/preferences.d.ts.map +1 -0
  47. package/dist/preferences.js +57 -0
  48. package/dist/preferences.js.map +1 -0
  49. package/dist/project.d.ts +45 -0
  50. package/dist/project.d.ts.map +1 -0
  51. package/dist/project.js +183 -0
  52. package/dist/project.js.map +1 -0
  53. package/dist/rankability.d.ts +51 -0
  54. package/dist/rankability.d.ts.map +1 -0
  55. package/dist/rankability.js +217 -0
  56. package/dist/rankability.js.map +1 -0
  57. package/dist/registry.d.ts +82 -0
  58. package/dist/registry.d.ts.map +1 -0
  59. package/dist/registry.js +300 -0
  60. package/dist/registry.js.map +1 -0
  61. package/dist/trust.d.ts +13 -0
  62. package/dist/trust.d.ts.map +1 -0
  63. package/dist/trust.js +41 -0
  64. package/dist/trust.js.map +1 -0
  65. package/dist/types.d.ts +44 -0
  66. package/dist/types.d.ts.map +1 -0
  67. package/dist/types.js +2 -0
  68. package/dist/types.js.map +1 -0
  69. package/library/3d/threejs/LICENSE.txt +21 -0
  70. package/library/3d/threejs/NOTICE.md +7 -0
  71. package/library/3d/threejs/SKILL.md +102 -0
  72. package/library/3d/threejs/luci.json +39 -0
  73. package/library/accessibility/accessibility-baseline/SKILL.md +51 -0
  74. package/library/accessibility/accessibility-baseline/luci.json +33 -0
  75. package/library/accessibility/fixing-accessibility/NOTICE.md +6 -0
  76. package/library/accessibility/fixing-accessibility/SKILL.md +141 -0
  77. package/library/accessibility/fixing-accessibility/luci.json +36 -0
  78. package/library/animation-motion/animation-systems/LICENSE.txt +21 -0
  79. package/library/animation-motion/animation-systems/NOTICE.md +7 -0
  80. package/library/animation-motion/animation-systems/SKILL.md +192 -0
  81. package/library/animation-motion/animation-systems/luci.json +32 -0
  82. package/library/animation-motion/animejs/SKILL.md +64 -0
  83. package/library/animation-motion/animejs/luci.json +12 -0
  84. package/library/animation-motion/motion-dev/SKILL.md +69 -0
  85. package/library/animation-motion/motion-dev/luci.json +13 -0
  86. package/library/animation-motion/react-view-transitions/AGENTS.md +1380 -0
  87. package/library/animation-motion/react-view-transitions/NOTICE.md +6 -0
  88. package/library/animation-motion/react-view-transitions/README.md +44 -0
  89. package/library/animation-motion/react-view-transitions/SKILL.md +334 -0
  90. package/library/animation-motion/react-view-transitions/luci.json +40 -0
  91. package/library/animation-motion/react-view-transitions/metadata.json +12 -0
  92. package/library/animation-motion/react-view-transitions/references/css-recipes.md +312 -0
  93. package/library/animation-motion/react-view-transitions/references/implementation.md +170 -0
  94. package/library/animation-motion/react-view-transitions/references/nextjs.md +233 -0
  95. package/library/animation-motion/react-view-transitions/references/patterns.md +274 -0
  96. package/library/animation-motion/react-view-transitions/references/troubleshooting.md +47 -0
  97. package/library/code-quality/code-review/NOTICE.md +6 -0
  98. package/library/code-quality/code-review/SKILL.md +94 -0
  99. package/library/code-quality/code-review/agents/openai.yaml +3 -0
  100. package/library/code-quality/code-review/luci.json +33 -0
  101. package/library/components/company-logos/LICENSE.txt +21 -0
  102. package/library/components/company-logos/NOTICE.md +7 -0
  103. package/library/components/company-logos/SKILL.md +27 -0
  104. package/library/components/company-logos/luci.json +38 -0
  105. package/library/components/container-lines/LICENSE.txt +21 -0
  106. package/library/components/container-lines/NOTICE.md +7 -0
  107. package/library/components/container-lines/SKILL.md +124 -0
  108. package/library/components/container-lines/luci.json +48 -0
  109. package/library/design-systems/build-design-system/NOTICE.md +6 -0
  110. package/library/design-systems/build-design-system/SKILL.md +78 -0
  111. package/library/design-systems/build-design-system/luci.json +29 -0
  112. package/library/design-systems/build-design-system/references/components.md +46 -0
  113. package/library/design-systems/build-design-system/references/glossary.md +77 -0
  114. package/library/design-systems/build-design-system/references/taste.md +37 -0
  115. package/library/design-systems/build-design-system/references/tokens.md +59 -0
  116. package/library/design-systems/build-design-system/references/traps.md +128 -0
  117. package/library/design-systems/build-design-system/scripts/capture-guard.mjs +470 -0
  118. package/library/design-systems/build-design-system/scripts/capture.mjs +355 -0
  119. package/library/design-systems/build-design-system/scripts/check-system.mjs +1883 -0
  120. package/library/design-systems/build-design-system/scripts/find-chromium.mjs +137 -0
  121. package/library/design-systems/build-design-system/scripts/oklch.mjs +221 -0
  122. package/library/design-systems/build-design-system/scripts/pixdiff.mjs +186 -0
  123. package/library/design-systems/component-docs/NOTICE.md +6 -0
  124. package/library/design-systems/component-docs/SKILL.md +50 -0
  125. package/library/design-systems/component-docs/luci.json +30 -0
  126. package/library/design-systems/component-docs/references/doc-format.md +85 -0
  127. package/library/design-systems/create-design-md/NOTICE.md +6 -0
  128. package/library/design-systems/create-design-md/SKILL.md +259 -0
  129. package/library/design-systems/create-design-md/luci.json +38 -0
  130. package/library/design-systems/design-system-boss/NOTICE.md +6 -0
  131. package/library/design-systems/design-system-boss/SKILL.md +58 -0
  132. package/library/design-systems/design-system-boss/luci.json +29 -0
  133. package/library/design-systems/design-system-boss/playbooks/build.md +10 -0
  134. package/library/design-systems/design-system-boss/playbooks/component.md +9 -0
  135. package/library/design-systems/design-system-boss/playbooks/migrate.md +11 -0
  136. package/library/design-systems/design-system-boss/playbooks/review.md +9 -0
  137. package/library/design-systems/migrate-design-system/NOTICE.md +6 -0
  138. package/library/design-systems/migrate-design-system/SKILL.md +62 -0
  139. package/library/design-systems/migrate-design-system/luci.json +33 -0
  140. package/library/design-systems/migrate-design-system/references/correct.md +37 -0
  141. package/library/design-systems/migrate-design-system/references/lessons.md +69 -0
  142. package/library/design-systems/migrate-design-system/references/parity.md +44 -0
  143. package/library/design-systems/migrate-design-system/references/running-many-agents.md +52 -0
  144. package/library/design-systems/migrate-design-system/scripts/bodies-check.mjs +215 -0
  145. package/library/design-systems/migrate-design-system/scripts/land.mjs +433 -0
  146. package/library/design-systems/migrate-design-system/scripts/legacy.mjs +283 -0
  147. package/library/design-systems/migrate-design-system/scripts/parity.mjs +173 -0
  148. package/library/design-systems/token-mapping/NOTICE.md +6 -0
  149. package/library/design-systems/token-mapping/SKILL.md +46 -0
  150. package/library/design-systems/token-mapping/luci.json +25 -0
  151. package/library/design-systems/token-mapping/references/mapping-rules.md +54 -0
  152. package/library/design-systems/ui-review/NOTICE.md +6 -0
  153. package/library/design-systems/ui-review/SKILL.md +53 -0
  154. package/library/design-systems/ui-review/luci.json +29 -0
  155. package/library/design-systems/ui-review/references/criteria.md +49 -0
  156. package/library/frontend/composition-patterns/AGENTS.md +946 -0
  157. package/library/frontend/composition-patterns/NOTICE.md +6 -0
  158. package/library/frontend/composition-patterns/README.md +60 -0
  159. package/library/frontend/composition-patterns/SKILL.md +86 -0
  160. package/library/frontend/composition-patterns/luci.json +33 -0
  161. package/library/frontend/composition-patterns/metadata.json +11 -0
  162. package/library/frontend/composition-patterns/rules/_sections.md +29 -0
  163. package/library/frontend/composition-patterns/rules/_template.md +24 -0
  164. package/library/frontend/composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
  165. package/library/frontend/composition-patterns/rules/architecture-compound-components.md +112 -0
  166. package/library/frontend/composition-patterns/rules/patterns-children-over-render-props.md +87 -0
  167. package/library/frontend/composition-patterns/rules/patterns-explicit-variants.md +100 -0
  168. package/library/frontend/composition-patterns/rules/react19-no-forwardref.md +42 -0
  169. package/library/frontend/composition-patterns/rules/state-context-interface.md +191 -0
  170. package/library/frontend/composition-patterns/rules/state-decouple-implementation.md +113 -0
  171. package/library/frontend/composition-patterns/rules/state-lift-state.md +125 -0
  172. package/library/frontend/design-mobile-apps/NOTICE.md +6 -0
  173. package/library/frontend/design-mobile-apps/SKILL.md +121 -0
  174. package/library/frontend/design-mobile-apps/designing.md +56 -0
  175. package/library/frontend/design-mobile-apps/endpoints.md +362 -0
  176. package/library/frontend/design-mobile-apps/implementing.md +213 -0
  177. package/library/frontend/design-mobile-apps/luci.json +31 -0
  178. package/library/frontend/design-mobile-apps/styling/nativewind.md +57 -0
  179. package/library/frontend/design-mobile-apps/styling/stylesheet.md +28 -0
  180. package/library/frontend/design-mobile-apps/styling/uniwind.md +38 -0
  181. package/library/frontend/frontend-design/LICENSE.txt +202 -0
  182. package/library/frontend/frontend-design/NOTICE.md +6 -0
  183. package/library/frontend/frontend-design/SKILL.md +81 -0
  184. package/library/frontend/frontend-design/luci.json +43 -0
  185. package/library/frontend/react-native-skills/AGENTS.md +2897 -0
  186. package/library/frontend/react-native-skills/NOTICE.md +6 -0
  187. package/library/frontend/react-native-skills/README.md +165 -0
  188. package/library/frontend/react-native-skills/SKILL.md +119 -0
  189. package/library/frontend/react-native-skills/luci.json +33 -0
  190. package/library/frontend/react-native-skills/metadata.json +16 -0
  191. package/library/frontend/react-native-skills/rules/_sections.md +86 -0
  192. package/library/frontend/react-native-skills/rules/_template.md +28 -0
  193. package/library/frontend/react-native-skills/rules/animation-derived-value.md +53 -0
  194. package/library/frontend/react-native-skills/rules/animation-gesture-detector-press.md +95 -0
  195. package/library/frontend/react-native-skills/rules/animation-gpu-properties.md +65 -0
  196. package/library/frontend/react-native-skills/rules/design-system-compound-components.md +66 -0
  197. package/library/frontend/react-native-skills/rules/fonts-config-plugin.md +71 -0
  198. package/library/frontend/react-native-skills/rules/imports-design-system-folder.md +68 -0
  199. package/library/frontend/react-native-skills/rules/js-hoist-intl.md +61 -0
  200. package/library/frontend/react-native-skills/rules/list-performance-callbacks.md +44 -0
  201. package/library/frontend/react-native-skills/rules/list-performance-function-references.md +132 -0
  202. package/library/frontend/react-native-skills/rules/list-performance-images.md +53 -0
  203. package/library/frontend/react-native-skills/rules/list-performance-inline-objects.md +97 -0
  204. package/library/frontend/react-native-skills/rules/list-performance-item-expensive.md +94 -0
  205. package/library/frontend/react-native-skills/rules/list-performance-item-memo.md +82 -0
  206. package/library/frontend/react-native-skills/rules/list-performance-item-types.md +104 -0
  207. package/library/frontend/react-native-skills/rules/list-performance-virtualize.md +67 -0
  208. package/library/frontend/react-native-skills/rules/monorepo-native-deps-in-app.md +46 -0
  209. package/library/frontend/react-native-skills/rules/monorepo-single-dependency-versions.md +63 -0
  210. package/library/frontend/react-native-skills/rules/navigation-native-navigators.md +188 -0
  211. package/library/frontend/react-native-skills/rules/react-compiler-destructure-functions.md +50 -0
  212. package/library/frontend/react-native-skills/rules/react-compiler-reanimated-shared-values.md +48 -0
  213. package/library/frontend/react-native-skills/rules/react-state-dispatcher.md +91 -0
  214. package/library/frontend/react-native-skills/rules/react-state-fallback.md +56 -0
  215. package/library/frontend/react-native-skills/rules/react-state-minimize.md +65 -0
  216. package/library/frontend/react-native-skills/rules/rendering-no-falsy-and.md +74 -0
  217. package/library/frontend/react-native-skills/rules/rendering-text-in-text-component.md +36 -0
  218. package/library/frontend/react-native-skills/rules/scroll-position-no-state.md +82 -0
  219. package/library/frontend/react-native-skills/rules/state-ground-truth.md +80 -0
  220. package/library/frontend/react-native-skills/rules/ui-expo-image.md +66 -0
  221. package/library/frontend/react-native-skills/rules/ui-image-gallery.md +104 -0
  222. package/library/frontend/react-native-skills/rules/ui-measure-views.md +78 -0
  223. package/library/frontend/react-native-skills/rules/ui-menus.md +174 -0
  224. package/library/frontend/react-native-skills/rules/ui-native-modals.md +77 -0
  225. package/library/frontend/react-native-skills/rules/ui-pressable.md +61 -0
  226. package/library/frontend/react-native-skills/rules/ui-safe-area-scroll.md +65 -0
  227. package/library/frontend/react-native-skills/rules/ui-scrollview-content-inset.md +45 -0
  228. package/library/frontend/react-native-skills/rules/ui-styling.md +87 -0
  229. package/library/frontend/tailwindcss/LICENSE.txt +21 -0
  230. package/library/frontend/tailwindcss/NOTICE.md +7 -0
  231. package/library/frontend/tailwindcss/SKILL.md +83 -0
  232. package/library/frontend/tailwindcss/luci.json +39 -0
  233. package/library/frontend-frameworks/react-best-practices/NOTICE.md +6 -0
  234. package/library/frontend-frameworks/react-best-practices/SKILL.md +151 -0
  235. package/library/frontend-frameworks/react-best-practices/luci.json +39 -0
  236. package/library/general/algorithmic-art/LICENSE.txt +202 -0
  237. package/library/general/algorithmic-art/NOTICE.md +6 -0
  238. package/library/general/algorithmic-art/SKILL.md +409 -0
  239. package/library/general/algorithmic-art/luci.json +27 -0
  240. package/library/general/algorithmic-art/templates/generator_template.js +223 -0
  241. package/library/general/algorithmic-art/templates/viewer.html +599 -0
  242. package/library/general/canvas-design/LICENSE.txt +202 -0
  243. package/library/general/canvas-design/NOTICE.md +6 -0
  244. package/library/general/canvas-design/SKILL.md +134 -0
  245. package/library/general/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -0
  246. package/library/general/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -0
  247. package/library/general/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -0
  248. package/library/general/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
  249. package/library/general/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -0
  250. package/library/general/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -0
  251. package/library/general/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -0
  252. package/library/general/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -0
  253. package/library/general/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -0
  254. package/library/general/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
  255. package/library/general/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
  256. package/library/general/canvas-design/canvas-fonts/Italiana-OFL.txt +93 -0
  257. package/library/general/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
  258. package/library/general/canvas-design/canvas-fonts/Jura-OFL.txt +93 -0
  259. package/library/general/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
  260. package/library/general/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
  261. package/library/general/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -0
  262. package/library/general/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
  263. package/library/general/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
  264. package/library/general/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -0
  265. package/library/general/canvas-design/canvas-fonts/PoiretOne-OFL.txt +93 -0
  266. package/library/general/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -0
  267. package/library/general/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -0
  268. package/library/general/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -0
  269. package/library/general/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
  270. package/library/general/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -0
  271. package/library/general/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
  272. package/library/general/canvas-design/luci.json +29 -0
  273. package/library/index.json +2507 -0
  274. package/library/interaction/animation-on-scroll/LICENSE.txt +21 -0
  275. package/library/interaction/animation-on-scroll/NOTICE.md +7 -0
  276. package/library/interaction/animation-on-scroll/SKILL.md +115 -0
  277. package/library/interaction/animation-on-scroll/luci.json +38 -0
  278. package/library/micro-interactions/masked-reveal/LICENSE.txt +21 -0
  279. package/library/micro-interactions/masked-reveal/NOTICE.md +7 -0
  280. package/library/micro-interactions/masked-reveal/SKILL.md +187 -0
  281. package/library/micro-interactions/masked-reveal/luci.json +63 -0
  282. package/library/micro-interactions/micro-interaction/NOTICE.md +6 -0
  283. package/library/micro-interactions/micro-interaction/SKILL.md +177 -0
  284. package/library/micro-interactions/micro-interaction/luci.json +52 -0
  285. package/library/micro-interactions/micro-interaction/references/css-recipes.md +142 -0
  286. package/library/micro-interactions/micro-interaction/references/framer-motion-recipes.md +187 -0
  287. package/library/micro-interactions/micro-interaction/scripts/README.md +42 -0
  288. package/library/micro-interactions/micro-interaction/scripts/contact-sheet.sh +17 -0
  289. package/library/micro-interactions/micro-interaction/scripts/seek-shot.sh +21 -0
  290. package/library/performance/fixing-motion-performance/NOTICE.md +6 -0
  291. package/library/performance/fixing-motion-performance/SKILL.md +156 -0
  292. package/library/performance/fixing-motion-performance/luci.json +30 -0
  293. package/library/seo/fixing-metadata/NOTICE.md +6 -0
  294. package/library/seo/fixing-metadata/SKILL.md +111 -0
  295. package/library/seo/fixing-metadata/luci.json +36 -0
  296. package/library/shadcn-ui/migrate-radix-to-base/NOTICE.md +6 -0
  297. package/library/shadcn-ui/migrate-radix-to-base/SKILL.md +178 -0
  298. package/library/shadcn-ui/migrate-radix-to-base/class-mapping.md +62 -0
  299. package/library/shadcn-ui/migrate-radix-to-base/consumer-props.md +58 -0
  300. package/library/shadcn-ui/migrate-radix-to-base/disclosure.md +353 -0
  301. package/library/shadcn-ui/migrate-radix-to-base/display-misc.md +410 -0
  302. package/library/shadcn-ui/migrate-radix-to-base/form-controls.md +390 -0
  303. package/library/shadcn-ui/migrate-radix-to-base/luci.json +33 -0
  304. package/library/shadcn-ui/migrate-radix-to-base/menus.md +409 -0
  305. package/library/shadcn-ui/migrate-radix-to-base/overlays.md +459 -0
  306. package/library/shadcn-ui/migrate-radix-to-base/universal-patterns.md +286 -0
  307. package/library/shadcn-ui/migrate-radix-to-base/wrapper-shapes.md +110 -0
  308. package/library/shadcn-ui/shadcn/NOTICE.md +6 -0
  309. package/library/shadcn-ui/shadcn/SKILL.md +187 -0
  310. package/library/shadcn-ui/shadcn/agents/openai.yml +5 -0
  311. package/library/shadcn-ui/shadcn/assets/shadcn-small.png +0 -0
  312. package/library/shadcn-ui/shadcn/assets/shadcn.png +0 -0
  313. package/library/shadcn-ui/shadcn/assets/showcase/color-pair.tsx +126 -0
  314. package/library/shadcn-ui/shadcn/assets/showcase/preview-states.css +14 -0
  315. package/library/shadcn-ui/shadcn/assets/showcase/state-matrix.tsx +72 -0
  316. package/library/shadcn-ui/shadcn/cli.md +290 -0
  317. package/library/shadcn-ui/shadcn/customization.md +211 -0
  318. package/library/shadcn-ui/shadcn/design-system-page.md +268 -0
  319. package/library/shadcn-ui/shadcn/design-system.md +386 -0
  320. package/library/shadcn-ui/shadcn/evals/evals.json +126 -0
  321. package/library/shadcn-ui/shadcn/luci.json +34 -0
  322. package/library/shadcn-ui/shadcn/mcp.md +105 -0
  323. package/library/shadcn-ui/shadcn/references/updating-components.md +91 -0
  324. package/library/shadcn-ui/shadcn/references/workflow.md +31 -0
  325. package/library/shadcn-ui/shadcn/registry.md +277 -0
  326. package/library/shadcn-ui/shadcn/rules/base-vs-radix.md +306 -0
  327. package/library/shadcn-ui/shadcn/rules/chat.md +507 -0
  328. package/library/shadcn-ui/shadcn/rules/composition.md +213 -0
  329. package/library/shadcn-ui/shadcn/rules/forms.md +192 -0
  330. package/library/shadcn-ui/shadcn/rules/icons.md +101 -0
  331. package/library/shadcn-ui/shadcn/rules/styling.md +185 -0
  332. package/library/shadcn-ui/shadcn/scripts/showcase-coverage.mjs +53 -0
  333. package/library/systems/baseline-ui/NOTICE.md +6 -0
  334. package/library/systems/baseline-ui/SKILL.md +90 -0
  335. package/library/systems/baseline-ui/luci.json +35 -0
  336. package/library/testing/tdd/NOTICE.md +6 -0
  337. package/library/testing/tdd/SKILL.md +43 -0
  338. package/library/testing/tdd/agents/openai.yaml +3 -0
  339. package/library/testing/tdd/luci.json +29 -0
  340. package/library/testing/tdd/mocking.md +59 -0
  341. package/library/testing/tdd/tests.md +77 -0
  342. package/library/testing/webapp-testing/LICENSE.txt +202 -0
  343. package/library/testing/webapp-testing/NOTICE.md +6 -0
  344. package/library/testing/webapp-testing/SKILL.md +100 -0
  345. package/library/testing/webapp-testing/examples/console_logging.py +35 -0
  346. package/library/testing/webapp-testing/examples/element_discovery.py +40 -0
  347. package/library/testing/webapp-testing/examples/static_html_automation.py +33 -0
  348. package/library/testing/webapp-testing/luci.json +33 -0
  349. package/library/testing/webapp-testing/scripts/with_server.py +106 -0
  350. package/library/ui-ux/improve-ui/NOTICE.md +6 -0
  351. package/library/ui-ux/improve-ui/SKILL.md +127 -0
  352. package/library/ui-ux/improve-ui/agents/openai.yaml +13 -0
  353. package/library/ui-ux/improve-ui/luci.json +47 -0
  354. package/library/ui-ux/improve-ui/references/plan-template.md +55 -0
  355. package/library/ui-ux/landing-page/LICENSE.txt +21 -0
  356. package/library/ui-ux/landing-page/NOTICE.md +7 -0
  357. package/library/ui-ux/landing-page/SKILL.md +213 -0
  358. package/library/ui-ux/landing-page/luci.json +47 -0
  359. package/library/ui-ux/pricing-page/LICENSE.txt +21 -0
  360. package/library/ui-ux/pricing-page/NOTICE.md +7 -0
  361. package/library/ui-ux/pricing-page/SKILL.md +217 -0
  362. package/library/ui-ux/pricing-page/luci.json +47 -0
  363. package/library/ui-ux/prototype/LOGIC.md +67 -0
  364. package/library/ui-ux/prototype/NOTICE.md +6 -0
  365. package/library/ui-ux/prototype/SKILL.md +31 -0
  366. package/library/ui-ux/prototype/UI.md +112 -0
  367. package/library/ui-ux/prototype/agents/openai.yaml +3 -0
  368. package/library/ui-ux/prototype/luci.json +33 -0
  369. package/library/ui-ux/theme-factory/LICENSE.txt +202 -0
  370. package/library/ui-ux/theme-factory/NOTICE.md +6 -0
  371. package/library/ui-ux/theme-factory/SKILL.md +62 -0
  372. package/library/ui-ux/theme-factory/luci.json +35 -0
  373. package/library/ui-ux/theme-factory/themes/arctic-frost.md +19 -0
  374. package/library/ui-ux/theme-factory/themes/botanical-garden.md +19 -0
  375. package/library/ui-ux/theme-factory/themes/desert-rose.md +19 -0
  376. package/library/ui-ux/theme-factory/themes/forest-canopy.md +19 -0
  377. package/library/ui-ux/theme-factory/themes/golden-hour.md +19 -0
  378. package/library/ui-ux/theme-factory/themes/midnight-galaxy.md +19 -0
  379. package/library/ui-ux/theme-factory/themes/modern-minimalist.md +19 -0
  380. package/library/ui-ux/theme-factory/themes/ocean-depths.md +19 -0
  381. package/library/ui-ux/theme-factory/themes/sunset-boulevard.md +19 -0
  382. package/library/ui-ux/theme-factory/themes/tech-innovation.md +19 -0
  383. package/package.json +21 -3
  384. package/packs/design-system-build.json +10 -0
  385. package/packs/design-system.json +16 -0
  386. package/packs/marketing.json +11 -0
  387. package/packs/motion.json +12 -0
  388. package/packs/ui.json +13 -0
  389. package/README.md +0 -3
@@ -0,0 +1,1380 @@
1
+ # React View Transitions
2
+
3
+ **Version 1.0.0**
4
+ Vercel Engineering
5
+
6
+ > **Note:**
7
+ > This standalone guide is compiled from `SKILL.md` and its reference files
8
+ > for agents that consume a single `AGENTS.md` document. Edit the source
9
+ > files, not this compiled copy.
10
+
11
+ ---
12
+
13
+ Animate between UI states using the browser's native `document.startViewTransition`. Declare *what* with `<ViewTransition>`, trigger *when* with `startTransition` / `useDeferredValue` / `Suspense`, control *how* with CSS classes. Unsupported browsers skip animations gracefully.
14
+
15
+ ## When to Animate
16
+
17
+ Every `<ViewTransition>` should communicate a spatial relationship or continuity. If you can't articulate what it communicates, don't add it.
18
+
19
+ Implement **all** applicable patterns from this list, in this order:
20
+
21
+ | Priority | Pattern | What it communicates |
22
+ |----------|---------|---------------------|
23
+ | 1 | **Shared element** (`name`) | "Same thing — going deeper" |
24
+ | 2 | **Suspense reveal** | "Data loaded" |
25
+ | 3 | **List identity** (per-item `key`) | "Same items, new arrangement" |
26
+ | 4 | **State change** (`enter`/`exit`) | "Something appeared/disappeared" |
27
+ | 5 | **Route change** (page-level) | "Going to a new place" |
28
+
29
+ This is an implementation order, not a "pick one" list. Implement every pattern that fits the app. Only skip a pattern if the app has no use case for it.
30
+
31
+ ### Choosing Animation Style
32
+
33
+ | Context | Animation | Why |
34
+ |---------|-----------|-----|
35
+ | Hierarchical navigation (list → detail) | Type-keyed `nav-forward` / `nav-back` | Communicates spatial depth |
36
+ | Lateral navigation (tab-to-tab) | Bare `<ViewTransition>` (fade) or `default="none"` | No depth to communicate |
37
+ | Suspense reveal | `enter`/`exit` string props | Content arriving |
38
+ | Revalidation / background refresh | `default="none"` | Silent — no animation needed |
39
+
40
+ Reserve directional slides for hierarchical navigation (list → detail) and ordered sequences (prev/next photo, carousel, paginated results). For ordered sequences, the direction communicates position: "next" slides from right, "previous" from left. Lateral/unordered navigation (tab-to-tab) should not use directional slides — it falsely implies spatial depth.
41
+
42
+ ---
43
+
44
+ ## Availability
45
+
46
+ - **Next.js:** Do **not** install `react@canary` — the App Router already bundles React canary internally. `ViewTransition` works out of the box. `npm ls react` may show a stable-looking version; this is expected.
47
+ - **Without Next.js:** Use stable `react` and `react-dom` 19.3 or newer (`ViewTransition` and `addTransitionType` became stable in React 19.3). Earlier stable React versions do not include these APIs.
48
+ - Browser support: Chromium 125+ (React needs the v2 object form of `startViewTransition`), Firefox 144+, Safari 18.2+. Graceful degradation on unsupported browsers.
49
+
50
+ ---
51
+
52
+ ## Implementation Workflow
53
+
54
+ When adding view transitions to an existing app, **follow [references/implementation.md](references/implementation.md) step by step.** Start with the audit — do not skip it. Use [references/css-recipes.md](references/css-recipes.md) for the applicable CSS and adapt it to the app.
55
+
56
+ ---
57
+
58
+ ## Core Concepts
59
+
60
+ ### The `<ViewTransition>` Component
61
+
62
+ ```jsx
63
+ import { ViewTransition } from 'react';
64
+
65
+ <ViewTransition>
66
+ <Component />
67
+ </ViewTransition>
68
+ ```
69
+
70
+ React auto-assigns a unique `view-transition-name` and calls `document.startViewTransition` behind the scenes. Never call `startViewTransition` yourself.
71
+
72
+ ### Animation Triggers
73
+
74
+ | Trigger | When it fires |
75
+ |---------|--------------|
76
+ | **enter** | `<ViewTransition>` first inserted during a Transition |
77
+ | **exit** | `<ViewTransition>` first removed during a Transition |
78
+ | **update** | DOM mutations inside a `<ViewTransition>`, or the boundary itself changing size/position due to an immediate sibling. With nested VTs, mutation applies to the innermost one |
79
+ | **share** | Named VT unmounts and another with same `name` mounts in the same Transition |
80
+
81
+ Only `startTransition`, `useDeferredValue`, or `Suspense` activate VTs. Regular `setState` does not animate.
82
+
83
+ ### Critical Placement Rule
84
+
85
+ `<ViewTransition>` only activates enter/exit if it appears **before any DOM nodes**:
86
+
87
+ ```jsx
88
+ // Works
89
+ <ViewTransition enter="auto" exit="auto">
90
+ <div>Content</div>
91
+ </ViewTransition>
92
+
93
+ // Broken — div wraps the VT, suppressing enter/exit
94
+ <div>
95
+ <ViewTransition enter="auto" exit="auto">
96
+ <div>Content</div>
97
+ </ViewTransition>
98
+ </div>
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Styling with View Transition Classes
104
+
105
+ ### Props
106
+
107
+ Values: `"auto"` (browser cross-fade), `"none"` (disabled), `"class-name"` (custom CSS), or `{ [type]: value }` for type-specific animations.
108
+
109
+ ```jsx
110
+ <ViewTransition default="none" enter="slide-in" exit="slide-out" share="morph" />
111
+ ```
112
+
113
+ If `default` is `"none"`, all triggers are off unless explicitly listed.
114
+
115
+ ### CSS Pseudo-Elements
116
+
117
+ - `::view-transition-old(.class)` — outgoing snapshot
118
+ - `::view-transition-new(.class)` — incoming snapshot
119
+ - `::view-transition-group(.class)` — container
120
+ - `::view-transition-image-pair(.class)` — old + new pair
121
+
122
+ See [references/css-recipes.md](references/css-recipes.md) for ready-to-use animation recipes.
123
+
124
+ ---
125
+
126
+ ## Transition Types
127
+
128
+ Tag transitions with `addTransitionType` so VTs can pick different animations based on context. Call it multiple times to stack types — different VTs in the tree react to different types:
129
+
130
+ ```jsx
131
+ startTransition(() => {
132
+ addTransitionType('nav-forward');
133
+ addTransitionType('select-item');
134
+ router.push('/detail/1');
135
+ });
136
+ ```
137
+
138
+ Pass an object to map types to CSS classes. Works on `enter`, `exit`, **and** `share`:
139
+
140
+ ```jsx
141
+ <ViewTransition
142
+ enter={{ 'nav-forward': 'slide-from-right', 'nav-back': 'slide-from-left', default: 'none' }}
143
+ exit={{ 'nav-forward': 'slide-to-left', 'nav-back': 'slide-to-right', default: 'none' }}
144
+ share={{ 'nav-forward': 'morph-forward', 'nav-back': 'morph-back', default: 'morph' }}
145
+ default="none"
146
+ >
147
+ <Page />
148
+ </ViewTransition>
149
+ ```
150
+
151
+ `enter` and `exit` don't have to be symmetric. For example, fade in but slide out directionally:
152
+
153
+ ```jsx
154
+ <ViewTransition
155
+ enter={{ 'nav-forward': 'fade-in', 'nav-back': 'fade-in', default: 'none' }}
156
+ exit={{ 'nav-forward': 'nav-forward', 'nav-back': 'nav-back', default: 'none' }}
157
+ default="none"
158
+ >
159
+ ```
160
+
161
+ **TypeScript:** `ViewTransitionClassPerType` requires a `default` key in the object.
162
+
163
+ For apps with multiple pages, extract the type-keyed VT into a reusable wrapper:
164
+
165
+ ```jsx
166
+ export function DirectionalTransition({ children }: { children: React.ReactNode }) {
167
+ return (
168
+ <ViewTransition
169
+ enter={{ 'nav-forward': 'nav-forward', 'nav-back': 'nav-back', default: 'none' }}
170
+ exit={{ 'nav-forward': 'nav-forward', 'nav-back': 'nav-back', default: 'none' }}
171
+ default="none"
172
+ >
173
+ {children}
174
+ </ViewTransition>
175
+ );
176
+ }
177
+ ```
178
+
179
+ ### `router.back()` and Browser Back Button
180
+
181
+ `router.back()` and the browser's back/forward buttons carry **no transition types**, so type-keyed animations (directional slides) resolve to their `default` and don't play — untyped shared-element morphs still apply. For typed animations, use `router.push()` with an explicit URL.
182
+
183
+ ### Types and Suspense
184
+
185
+ Types are available during navigation but **not** during subsequent Suspense reveals (separate transitions, no type). Use type maps for page-level enter/exit; use simple string props for Suspense reveals.
186
+
187
+ ### Shared Element Readiness
188
+
189
+ A shared element transition can pair elements only when both the old and new views are rendered in the same Transition. If incoming content suspends, only its fallback exists for that update; the resolved content appears in a later Suspense transition and can be animated separately.
190
+
191
+ ---
192
+
193
+ ## Shared Element Transitions
194
+
195
+ Same `name` on two VTs — one unmounting, one mounting — creates a shared element morph:
196
+
197
+ ```jsx
198
+ <ViewTransition name="hero-image">
199
+ <img src="/thumb.jpg" onClick={() => startTransition(() => onSelect())} />
200
+ </ViewTransition>
201
+
202
+ // On the other view — same name
203
+ <ViewTransition name="hero-image">
204
+ <img src="/full.jpg" />
205
+ </ViewTransition>
206
+ ```
207
+
208
+ - Only one VT with a given `name` can be mounted at a time — use unique names (`photo-${id}`). Watch for reusable components: if a component with a named VT is rendered in both a modal/popover *and* a page, both mount simultaneously and break the morph. Either make the name conditional (via a prop) or move the named VT out of the shared component into the specific consumer.
209
+ - `share` takes precedence over `enter`/`exit`. Think through each navigation path: when no matching pair forms (e.g., the target page doesn't have the same name), `enter`/`exit` fires instead. Consider whether the element needs a fallback animation for those paths.
210
+ - Two ways a wired-up morph silently never fires: (1) `default="none"` with no explicit `share` prop — share resolves to none; (2) type-keyed `share` where the navigation never adds the type — a plain link click resolves the map's `default`. Every link that should morph must add the type (`transitionTypes` on `next/link`, or `addTransitionType`).
211
+ - Never use a fade-out exit on pages with shared morphs — use a directional slide instead.
212
+
213
+ ---
214
+
215
+ ## Common Patterns
216
+
217
+ ### Enter/Exit
218
+
219
+ ```jsx
220
+ {show && (
221
+ <ViewTransition enter="fade-in" exit="fade-out"><Panel /></ViewTransition>
222
+ )}
223
+ ```
224
+
225
+ ### List Reorder
226
+
227
+ ```jsx
228
+ {items.map(item => (
229
+ <ViewTransition key={item.id}><ItemCard item={item} /></ViewTransition>
230
+ ))}
231
+ ```
232
+
233
+ Trigger inside `startTransition`. Avoid wrapper `<div>`s between list and VT.
234
+
235
+ ### Layout Displacement Morph
236
+
237
+ Only content inside an activated boundary animates position — everything else teleports to its new layout spot. Wrap the sibling content below a growing/shrinking list in a bare `<ViewTransition>` so it glides instead of jumping. See [Layout Displacement Morph](references/patterns.md#layout-displacement-morph).
238
+
239
+ ### Composing Shared Elements with List Identity
240
+
241
+ Shared elements and list identity are independent concerns — don't confuse one for the other. When a list item contains a shared element (e.g., an image that morphs into a detail view), use two nested `<ViewTransition>` boundaries:
242
+
243
+ ```jsx
244
+ {items.map(item => (
245
+ <ViewTransition key={item.id}> {/* list identity */}
246
+ <Link href={`/items/${item.id}`}>
247
+ <ViewTransition name={`item-image-${item.id}`} share="morph"> {/* shared element */}
248
+ <Image src={item.image} />
249
+ </ViewTransition>
250
+ <p>{item.name}</p>
251
+ </Link>
252
+ </ViewTransition>
253
+ ))}
254
+ ```
255
+
256
+ The outer VT handles list reorder/enter animations. The inner VT handles the cross-route shared element morph. Missing either layer means that animation silently doesn't happen.
257
+
258
+ ### Force Re-Enter with `key`
259
+
260
+ ```jsx
261
+ <ViewTransition key={searchParams.toString()} enter="slide-up" default="none">
262
+ <ResultsGrid />
263
+ </ViewTransition>
264
+ ```
265
+
266
+ **Caution:** If wrapping `<Suspense>`, changing `key` remounts the boundary and refetches.
267
+
268
+ ### Suspense Fallback to Content
269
+
270
+ Simple cross-fade:
271
+ ```jsx
272
+ <ViewTransition>
273
+ <Suspense fallback={<Skeleton />}><Content /></Suspense>
274
+ </ViewTransition>
275
+ ```
276
+
277
+ Directional reveal:
278
+ ```jsx
279
+ <Suspense fallback={<ViewTransition exit="slide-down"><Skeleton /></ViewTransition>}>
280
+ <ViewTransition enter="slide-up" default="none"><Content /></ViewTransition>
281
+ </Suspense>
282
+ ```
283
+
284
+ For more patterns, see [references/patterns.md](references/patterns.md).
285
+
286
+ ---
287
+
288
+ ## How Multiple VTs Interact
289
+
290
+ Every VT matching the trigger fires simultaneously in a single `document.startViewTransition`. VTs in **different** transitions (navigation vs later Suspense resolve) don't compete.
291
+
292
+ ### Use `default="none"` Deliberately
293
+
294
+ Without it, every VT fires the browser cross-fade on **every** transition — Suspense resolves, `useDeferredValue` updates, background revalidations. Use `default="none"` on named/shared elements and type-keyed page VTs.
295
+
296
+ But it also turns off `update` (layout/reflow morphs) and `share` (a named pair with no explicit `share` prop never morphs). Keyed list items and displaced siblings *want* update — leave them bare or set `update="auto"`.
297
+
298
+ ### Two Patterns Coexist
299
+
300
+ **Pattern A — Directional slides:** Type-keyed VT on each page, fires during navigation.
301
+ **Pattern B — Suspense reveals:** Simple string props, fires when data loads (no type).
302
+
303
+ They coexist because they fire at different moments. `default="none"` on both prevents cross-interference. Always pair `enter` with `exit`. Place directional VTs in page components, not layouts.
304
+
305
+ ### Nested VT Limitation
306
+
307
+ When a parent VT mounts/unmounts **as one unit** with nested VTs inside it, the nested ones do not fire their own enter/exit — only the outermost VT animates. (A child VT mounted inside a *persistent* parent VT fires enter/exit normally.) Per-item staggered animations during page navigation are not currently available in Next.js; see [troubleshooting](references/troubleshooting.md) for the upstream experimental status.
308
+
309
+ ---
310
+
311
+ ## Next.js Integration
312
+
313
+ For Next.js integration (`transitionTypes` on `next/link` and `useRouter`, App Router patterns, Server Components), see [references/nextjs.md](references/nextjs.md).
314
+
315
+ ---
316
+
317
+ ## Accessibility
318
+
319
+ Always add the reduced motion CSS from [references/css-recipes.md](references/css-recipes.md#reduced-motion) to your global stylesheet.
320
+
321
+ ---
322
+
323
+ ## Reference Files
324
+
325
+ - **[references/implementation.md](references/implementation.md)** — Step-by-step implementation workflow.
326
+ - **[references/patterns.md](references/patterns.md)** — Patterns, animation timing, and events API.
327
+ - **[references/troubleshooting.md](references/troubleshooting.md)** — Symptom-driven debugging and runtime limitations.
328
+ - **[references/css-recipes.md](references/css-recipes.md)** — Ready-to-use CSS animation recipes.
329
+ - **[references/nextjs.md](references/nextjs.md)** — Next.js App Router patterns and Server Component details.
330
+
331
+ ---
332
+
333
+ # Implementation Workflow
334
+
335
+ Follow these steps in order when adding view transitions to an app. Each step builds on the previous one.
336
+
337
+ Use the official [React `<ViewTransition>` reference](https://react.dev/reference/react/ViewTransition) and [Next.js guide](https://nextjs.org/docs/app/guides/view-transitions) for API behavior. This file focuses on audit order, integration decisions, and verification.
338
+
339
+ ## Step 1: Audit the App
340
+
341
+ Before writing any code, scan the codebase thoroughly. Search for:
342
+
343
+ - **Every `<Link>` and `router.push`** — these are your navigation triggers. Open every file that contains one.
344
+ - **Every `<Suspense>` boundary** — each one is a candidate for a reveal animation. Check what its fallback renders.
345
+ - **Every page/route component** — list them all. Each page needs a VT placement decision.
346
+ - **Persistent elements** — headers, navbars, sidebars, sticky controls that stay on screen across navigations. These need `viewTransitionName` isolation.
347
+ - **Shared visual elements** — images, cards, or avatars that appear on both a source and target view (e.g., a thumbnail in a list and the same image on a detail page).
348
+ - **Skeleton-to-content control pairs** — if a Suspense fallback renders a control (search input, tab bar) that also exists in the real content, both need a matching `viewTransitionName`.
349
+
350
+ Then classify every navigation and produce a navigation map:
351
+
352
+ ```
353
+ | Route | Navigates to | Direction | VT pattern |
354
+ |-----------------|----------------------|--------------|-----------------------|
355
+ | / | /detail/[id] | forward | directional slide |
356
+ | /detail/[id] | / | back | directional slide |
357
+ | /detail/[id] | /detail/[other] | sequential | directional slide (ordered prev/next) or key+share crossfade |
358
+ | /tab/[a] | /tab/[b] | lateral | key+share crossfade |
359
+ | (Suspense) | (content loads) | — | slide-up reveal |
360
+ ```
361
+
362
+ For each shared element (`name` prop), note every navigation where a pair forms and where it doesn't — this determines whether you need `enter`/`exit` as a fallback alongside `share`.
363
+
364
+ ## Step 2: Add CSS Recipes
365
+
366
+ Choose the animation pattern from the audit and this skill's guidance, then copy only the applicable sections from [css-recipes.md](css-recipes.md). Always include reduced motion. Add live-root, persistent-element, backdrop, or floating-element rules only when the audit found those surfaces.
367
+
368
+ Customize timing after the structure works. Keep ordinary crossfades opacity-only; scope blur to a specific shared morph when it is intentional.
369
+
370
+ ## Step 3: Isolate Persistent Elements
371
+
372
+ For every persistent element identified in Step 1, add a `viewTransitionName` style to pull it out of the page content's transition snapshot:
373
+
374
+ ```jsx
375
+ <header style={{ viewTransitionName: "site-header" }}>...</header>
376
+ ```
377
+
378
+ Then add the [Persistent Element Isolation](css-recipes.md#persistent-element-isolation) CSS (prevents the element from animating during page transitions). If the element uses `backdrop-blur` or `backdrop-filter`, use the [Backdrop-Blur Workaround](css-recipes.md#backdrop-blur-workaround) instead.
379
+
380
+ If a Suspense fallback mirrors a persistent control (e.g., a skeleton search input), give both the real control and the skeleton the same `viewTransitionName` so they morph in place.
381
+
382
+ ## Step 4: Add Directional Page Transitions
383
+
384
+ For hierarchical navigations identified in Step 1, tag the navigation direction using `addTransitionType` inside `startTransition`:
385
+
386
+ ```jsx
387
+ startTransition(() => {
388
+ addTransitionType('nav-forward');
389
+ router.push('/detail/1');
390
+ });
391
+ ```
392
+
393
+ Then wrap each **page component** (not layout) in a type-keyed `<ViewTransition>`:
394
+
395
+ ```jsx
396
+ <ViewTransition
397
+ enter={{
398
+ "nav-forward": "nav-forward",
399
+ "nav-back": "nav-back",
400
+ default: "none",
401
+ }}
402
+ exit={{
403
+ "nav-forward": "nav-forward",
404
+ "nav-back": "nav-back",
405
+ default: "none",
406
+ }}
407
+ default="none"
408
+ >
409
+ <div>...page content...</div>
410
+ </ViewTransition>
411
+ ```
412
+
413
+ The `nav-forward` and `nav-back` CSS classes from [Directional Navigation](css-recipes.md#directional-navigation) produce horizontal slides. For simpler apps where directional motion isn't needed, a bare `<ViewTransition default="none">` wrapper with `enter="fade-in"` / `exit="fade-out"` works too.
414
+
415
+ Extract this into a reusable component so every page doesn't repeat the verbose type map:
416
+
417
+ ```jsx
418
+ export function DirectionalTransition({ children }: { children: React.ReactNode }) {
419
+ return (
420
+ <ViewTransition
421
+ enter={{ 'nav-forward': 'nav-forward', 'nav-back': 'nav-back', default: 'none' }}
422
+ exit={{ 'nav-forward': 'nav-forward', 'nav-back': 'nav-back', default: 'none' }}
423
+ default="none"
424
+ >
425
+ {children}
426
+ </ViewTransition>
427
+ );
428
+ }
429
+ ```
430
+
431
+ This also becomes the single place to adjust if you add new transition types later.
432
+
433
+ **Rules:**
434
+ - Always pair `enter` with `exit` — without an exit animation, the old page disappears instantly while the new one animates in.
435
+ - Always include `default: "none"` in type map objects and `default="none"` on the component — otherwise it fires on every transition.
436
+ - Place the directional `<ViewTransition>` in each page component, not in a layout. Layouts persist across navigations and never trigger enter/exit.
437
+ - Only use directional slides for hierarchical navigation or ordered sequences (prev/next). Lateral/sibling navigation (tab-to-tab) should use a bare `<ViewTransition>` (cross-fade) or `default="none"`.
438
+
439
+ ## Step 5: Add Suspense Reveals
440
+
441
+ For every `<Suspense>` boundary identified in Step 1, wrap the fallback and content in separate `<ViewTransition>`s:
442
+
443
+ ```jsx
444
+ <Suspense
445
+ fallback={
446
+ <ViewTransition exit="slide-down">
447
+ <Skeleton />
448
+ </ViewTransition>
449
+ }
450
+ >
451
+ <ViewTransition enter="slide-up" default="none">
452
+ <AsyncContent />
453
+ </ViewTransition>
454
+ </Suspense>
455
+ ```
456
+
457
+ This example uses `slide-down` / `slide-up` for directional vertical motion. For a simpler reveal, a bare `<ViewTransition>` around the `<Suspense>` gives a cross-fade with zero configuration. Choose based on the spatial meaning described in the main skill.
458
+
459
+ **Rules:**
460
+ - Always use `default="none"` on the content `<ViewTransition>` to prevent re-animation on revalidation or unrelated transitions.
461
+ - Use simple string props (not type maps) on Suspense `<ViewTransition>`s — Suspense resolves fire as separate transitions with no type, so type-keyed props won't match.
462
+ - A fallback/content `share` pair morphs between snapshots. Use it only when that interpolation is desired and does not distort layout or geometry.
463
+ - If the same element appears in **both** the fallback and the content (a title, a heading), it flickers on reveal — an opacity dip. Render it **outside** the `<Suspense>` boundary (or pin it), so it isn't in both. See [Suspense reveal flicker](patterns.md#suspense-reveal-flicker).
464
+
465
+ ## Step 6: Add Shared Element Transitions
466
+
467
+ For every shared visual element identified in Step 1, add matching named `<ViewTransition>` wrappers on both the source and target views:
468
+
469
+ ```jsx
470
+ // On the source view (e.g., list/grid page)
471
+ <ViewTransition name={`photo-${photo.id}`} share="morph" default="none">
472
+ <Image src={photo.src} ... />
473
+ </ViewTransition>
474
+
475
+ // On the target view (e.g., detail page) — same name
476
+ <ViewTransition name={`photo-${photo.id}`} share="morph">
477
+ <Image src={photo.src} ... />
478
+ </ViewTransition>
479
+ ```
480
+
481
+ The `share="morph"` class uses the [Shared Element Morph](css-recipes.md#shared-element-morph) recipe (controlled duration + motion blur). For a simpler cross-fade, use `share="auto"` (browser default).
482
+
483
+ When list items contain shared elements, compose both patterns with two nested `<ViewTransition>` layers — an outer keyed VT for list identity and an inner named VT for the cross-route pair. See [Composing Shared Elements with List Identity](../SKILL.md#composing-shared-elements-with-list-identity).
484
+
485
+ **Rules:**
486
+ - Names must be globally unique — use prefixes like `photo-${id}`.
487
+ - Add `default="none"` on list-side shared elements to prevent per-item cross-fades on filter/search updates.
488
+ - The target must be **in the DOM at navigation time** for the pair to form. If it's behind a Suspense fallback (not rendered yet), no pair forms and it won't morph. It works when the target is present at the snapshot — render it above the data boundary, or have its data **cached/prefetched** so it resolves in time.
489
+
490
+ ## Step 7: Verify Each Navigation Path
491
+
492
+ Walk through every row in the navigation map from Step 1 and confirm:
493
+
494
+ - Does the VT mount/unmount on this navigation, or does it stay mounted (same-route)?
495
+ - For named VTs: does a shared pair form? If not, does `enter`/`exit` provide a fallback?
496
+ - Does `default="none"` block an animation you actually want?
497
+ - Do persistent elements stay static (not sliding with page content)?
498
+ - Do Suspense reveals animate independently from directional navigations?
499
+
500
+ If any path produces no animation or competing animations, use the symptom-driven [troubleshooting guide](troubleshooting.md).
501
+
502
+ For Next.js-specific implementation steps (`transitionTypes` on `<Link>`, prefetch behavior, and same-route dynamic segments), see [nextjs.md](nextjs.md).
503
+
504
+ ---
505
+
506
+ # Patterns and Guidelines
507
+
508
+ Use the official [React `<ViewTransition>` reference](https://react.dev/reference/react/ViewTransition) for API mechanics. This file collects reusable implementation patterns and failure modes from production apps.
509
+
510
+ ## Searchable Grid with `useDeferredValue`
511
+
512
+ `useDeferredValue` makes filter updates a transition, activating `<ViewTransition>`:
513
+
514
+ ```tsx
515
+ 'use client';
516
+
517
+ import { useDeferredValue, useState, ViewTransition, Suspense } from 'react';
518
+
519
+ export default function SearchableGrid({ itemsPromise }) {
520
+ const [search, setSearch] = useState('');
521
+ const deferredSearch = useDeferredValue(search);
522
+
523
+ return (
524
+ <>
525
+ <input value={search} onChange={(e) => setSearch(e.currentTarget.value)} />
526
+ <ViewTransition>
527
+ <Suspense fallback={<GridSkeleton />}>
528
+ <ItemGrid itemsPromise={itemsPromise} search={deferredSearch} />
529
+ </Suspense>
530
+ </ViewTransition>
531
+ </>
532
+ );
533
+ }
534
+ ```
535
+
536
+ Per-item `<ViewTransition name={...}>` inside a deferred list triggers cross-fades on every keystroke. Fix with `default="none"`:
537
+
538
+ ```tsx
539
+ {filteredItems.map(item => (
540
+ <ViewTransition key={item.id} name={`item-${item.id}`} share="morph" default="none">
541
+ <ItemCard item={item} />
542
+ </ViewTransition>
543
+ ))}
544
+ ```
545
+
546
+ ## Card Expand/Collapse with `startTransition`
547
+
548
+ Toggle between grid and detail view with shared element morph:
549
+
550
+ ```tsx
551
+ 'use client';
552
+
553
+ import { useState, useRef, startTransition, ViewTransition } from 'react';
554
+
555
+ export default function ItemGrid({ items }) {
556
+ const [expandedId, setExpandedId] = useState(null);
557
+ const scrollRef = useRef(0);
558
+
559
+ return expandedId ? (
560
+ <ViewTransition enter="slide-in" name={`item-${expandedId}`}>
561
+ <ItemDetail
562
+ item={items.find(i => i.id === expandedId)}
563
+ onClose={() => {
564
+ startTransition(() => {
565
+ setExpandedId(null);
566
+ setTimeout(() => window.scrollTo({ behavior: 'smooth', top: scrollRef.current }), 100);
567
+ });
568
+ }}
569
+ />
570
+ </ViewTransition>
571
+ ) : (
572
+ <div className="grid grid-cols-3 gap-4">
573
+ {items.map(item => (
574
+ <ViewTransition key={item.id} name={`item-${item.id}`}>
575
+ <ItemCard
576
+ item={item}
577
+ onSelect={() => {
578
+ scrollRef.current = window.scrollY;
579
+ startTransition(() => setExpandedId(item.id));
580
+ }}
581
+ />
582
+ </ViewTransition>
583
+ ))}
584
+ </div>
585
+ );
586
+ }
587
+ ```
588
+
589
+ ## Type-Safe Transition Helpers
590
+
591
+ Use `as const` arrays and derived types to prevent ID clashes:
592
+
593
+ ```tsx
594
+ const transitionTypes = ['default', 'transition-to-detail', 'transition-to-list'] as const;
595
+ const animationTypes = ['auto', 'none', 'animate-slide-from-left', 'animate-slide-from-right'] as const;
596
+
597
+ type TransitionType = (typeof transitionTypes)[number];
598
+ type AnimationType = (typeof animationTypes)[number];
599
+ type TransitionMap = { default: AnimationType } & Partial<Record<Exclude<TransitionType, 'default'>, AnimationType>>;
600
+
601
+ export function HorizontalTransition({ children, enter, exit }: {
602
+ children: React.ReactNode;
603
+ enter: TransitionMap;
604
+ exit: TransitionMap;
605
+ }) {
606
+ return <ViewTransition enter={enter} exit={exit}>{children}</ViewTransition>;
607
+ }
608
+ ```
609
+
610
+ ## Cross-Fade Without Remount
611
+
612
+ Omit `key` to trigger an update (cross-fade) instead of exit + enter. Avoids Suspense remount/refetch:
613
+
614
+ ```jsx
615
+ <ViewTransition>
616
+ <TabPanel tab={activeTab} />
617
+ </ViewTransition>
618
+ ```
619
+
620
+ Use `key` when content identity changes (state resets). Omit for cross-fades (tabs, panels, carousel).
621
+
622
+ ## Isolate Elements from Parent Animations
623
+
624
+ Pull an element out of the animated `root` snapshot by giving it its own `view-transition-name`. **`view-transition-name: none` is a no-op** — it's the CSS default, so the element stays in `root` (a common flicker bug). Use a real, unique name, then neutralize with `<ViewTransition default="none">` (no CSS) or CSS (needed for `z-index`/`display` control — see [css-recipes.md](css-recipes.md#persistent-element-isolation)).
625
+
626
+ - **Persistent chrome** (nav, sidebar, player bar): `<nav style={{ viewTransitionName: 'persistent-nav' }}>` + isolation CSS. `<ViewTransition default="none">` works too, but its auto-name can't take `z-index`/backdrop `display:none` — hand-name when you need those.
627
+ - **Floating elements** (popovers, menus): left open, they're captured in `root` and flicker on settle. Real name + isolation ([Floating Element Isolation](css-recipes.md#floating-element-isolation-popovers-menus-tooltips-control-clusters)). A static name is fine if only one is mounted (`unmountOnHide`); native top-layer (`popover`/`<dialog>`) settle-flicker is a browser limit.
628
+ - **Naming an interactive element has a cost:** named participants are skipped by hit-testing while a transition runs ([csswg#10930](https://github.com/w3c/csswg-drafts/issues/10930)) — clicks and hover fall through to whatever is beneath. Portal named popovers/menus; rendered inline in a clickable row, mid-transition clicks activate the row and read as outside-clicks that close the popover.
629
+ - **Third-party floating components** (toast libraries, portals you don't render): put the name on an always-mounted wrapper you own — `<div style={{ viewTransitionName: 'toaster' }} className="pointer-events-none fixed inset-0">`. Library containers often unmount when empty, so naming them directly leaves the group unpinned exactly when a toast appears mid-transition. Name a dialog's backdrop separately from its panel so each pins independently.
630
+
631
+ ## Suspense reveal flicker
632
+
633
+ An element rendered in **both** the fallback and the content flickers (opacity dip) on reveal — it fades against itself. Not a morph. **Fix: render it outside the `<Suspense>` boundary** (mount once, above it), or pin it with a `view-transition-name`.
634
+
635
+ ```jsx
636
+ <h1>{title}</h1>
637
+ <Suspense fallback={<BodySkeleton />}><Body /></Suspense>
638
+ ```
639
+
640
+ Don't put a manual `viewTransitionName` on the root DOM node inside `<ViewTransition>` — React's auto-name overrides it.
641
+
642
+ ## Sliding Indicator (tabs)
643
+
644
+ One shared-name indicator rendered under the **active** tab morphs between positions on change (slide the group, disable old/new — see [Sliding Indicator](css-recipes.md#sliding-indicator-tab-underline--segmented-pill)). Render it only under the active tab so exactly one element holds `indicatorName`; use a distinct `indicatorName` per tab strip. Trigger the state change inside `startTransition` so the move animates. Whatever owns `active` drives it — local state here, routing in Next (see [Routing-Driven Tabs](nextjs.md#routing-driven-tabs)).
645
+
646
+ ```tsx
647
+ import { useState, useTransition, ViewTransition } from 'react';
648
+
649
+ export function Tabs({ tabs, indicatorName = 'tab-indicator' }) {
650
+ const [active, setActive] = useState(tabs[0].value);
651
+ const [, startTransition] = useTransition();
652
+ return (
653
+ <nav>
654
+ {tabs.map(t => (
655
+ <button key={t.value} type="button"
656
+ aria-current={active === t.value ? 'page' : undefined}
657
+ onClick={() => startTransition(() => setActive(t.value))}>
658
+ <span>{t.label}</span>
659
+ {active === t.value && (
660
+ <ViewTransition name={indicatorName} share="tab-underline">
661
+ <span className="active-underline" aria-hidden />
662
+ </ViewTransition>
663
+ )}
664
+ </button>
665
+ ))}
666
+ </nav>
667
+ );
668
+ }
669
+ ```
670
+
671
+ Because the state change is a transition, if the newly-active tab renders suspending content the whole update — indicator **and** `aria-current` — waits for it to commit, and the strip feels dead on click. Give the controls an immediate value with `useOptimistic` (drive `aria-current` from it) so feedback is instant while the content streams. The routing variant ([Routing-Driven Tabs](nextjs.md#routing-driven-tabs)) does exactly this: optimistic `aria-current`, committed `active` for the bar.
672
+
673
+ ## Layout Displacement Morph
674
+
675
+ Only content inside an activated boundary animates position — everything else teleports to its new layout spot. When a list grows or shrinks, wrap the sibling content below it so it glides instead of jumping:
676
+
677
+ ```jsx
678
+ <FavoritesList /> {/* rows enter/exit */}
679
+ <ViewTransition> {/* bare: update enabled */}
680
+ <section>
681
+ <h2>You Might Also Like</h2>
682
+ <Recommendations />
683
+ </section>
684
+ </ViewTransition>
685
+ ```
686
+
687
+ The section — heading included — morphs as one group when rows above are added or removed. Nothing inside the section changed; the *displacement* is the update.
688
+
689
+ - React only measures boundaries that are direct children of nodes along the changed path — a VT buried under an extra wrapper element won't activate. Place the boundary as a direct sibling of the changing content.
690
+ - Sometimes the better fix is no morph at all: pad fixed-size lists to a constant slot count with invisible fillers so the grid never changes height and nothing below it moves.
691
+ - `default="none"` disables exactly this morph — it turns off `update`. Named/shared elements get `default="none"`; displaced siblings and keyed list items stay bare or set `update="auto"`.
692
+
693
+ ## Reusable Animated Collapse
694
+
695
+ ```jsx
696
+ function AnimatedCollapse({ open, children }) {
697
+ if (!open) return null;
698
+ return (
699
+ <ViewTransition enter="expand-in" exit="collapse-out">
700
+ {children}
701
+ </ViewTransition>
702
+ );
703
+ }
704
+
705
+ // Usage: toggle with startTransition
706
+ <button onClick={() => startTransition(() => setOpen(o => !o))}>Toggle</button>
707
+ <AnimatedCollapse open={open}><SectionContent /></AnimatedCollapse>
708
+ ```
709
+
710
+ ## Composing with Activity
711
+
712
+ `Activity` is orthogonal to view transitions: it preserves the state of a hidden subtree, `ViewTransition` animates it. Compose them for an in-page show/hide (drawer, panel, tab body) that keeps its scroll/form state while it animates in and out:
713
+
714
+ ```jsx
715
+ <Activity mode={isVisible ? 'visible' : 'hidden'}>
716
+ <ViewTransition enter="slide-in" exit="slide-out">
717
+ <Sidebar />
718
+ </ViewTransition>
719
+ </Activity>
720
+ ```
721
+
722
+ Only reach for Activity when there's state worth preserving — a stateless element (e.g. the sliding indicator above) gains nothing from it. In Next.js, layout-hosted chrome already persists across navigations without Activity (see [nextjs.md](nextjs.md#layout-level-viewtransition)).
723
+
724
+ ## Exclude Elements with `useOptimistic`
725
+
726
+ `useOptimistic` values update before the transition snapshot, excluding them from animation. Use for controls (labels); use committed state for animated content:
727
+
728
+ ```tsx
729
+ const [sort, setSort] = useState('newest');
730
+ const [optimisticSort, setOptimisticSort] = useOptimistic(sort);
731
+
732
+ function cycleSort() {
733
+ const nextSort = getNextSort(optimisticSort);
734
+ startTransition(() => {
735
+ setOptimisticSort(nextSort); // before snapshot — no animation
736
+ setSort(nextSort); // between snapshots — animates
737
+ });
738
+ }
739
+
740
+ <button>Sort: {LABELS[optimisticSort]}</button>
741
+ {items.sort(comparators[sort]).map(item => (
742
+ <ViewTransition key={item.id}><ItemCard item={item} /></ViewTransition>
743
+ ))}
744
+ ```
745
+
746
+ ---
747
+
748
+ ## View Transition Events
749
+
750
+ Imperative control via `onEnter`, `onExit`, `onUpdate`, `onShare`. Return a cleanup function to cancel your animation when the transition finishes. `onShare` takes precedence over `onEnter`/`onExit`.
751
+
752
+ ```jsx
753
+ <ViewTransition
754
+ onEnter={(instance, types) => {
755
+ const anim = instance.new.animate(
756
+ [{ transform: 'scale(0.8)', opacity: 0 }, { transform: 'scale(1)', opacity: 1 }],
757
+ { duration: 300, easing: 'ease-out' }
758
+ );
759
+ return () => anim.cancel();
760
+ }}
761
+ >
762
+ <Component />
763
+ </ViewTransition>
764
+ ```
765
+
766
+ The `instance` object: `instance.old`, `instance.new`, `instance.group`, `instance.imagePair`, `instance.name`.
767
+
768
+ The `types` array (second argument) lets you vary animation based on transition type.
769
+
770
+ ---
771
+
772
+ ## Animation Timing
773
+
774
+ | Interaction | Duration |
775
+ |------------|----------|
776
+ | Direct toggle (expand/collapse) | 100–200ms |
777
+ | Route transition (slide) | 150–250ms |
778
+ | Suspense reveal (skeleton → content) | 200–400ms |
779
+ | Shared element morph | 300–500ms |
780
+
781
+ ---
782
+
783
+ # Troubleshooting
784
+
785
+ **VT not activating:** Ensure `<ViewTransition>` comes before any DOM node and the state update is inside `startTransition`. A raw `viewTransitionName` only isolates an element; it does not activate a React view transition.
786
+
787
+ **"Two ViewTransition components with the same name":** Names must be globally unique. Use IDs such as `name={`hero-${item.id}`}`. If a reusable component appears in multiple surfaces at once, move the name to the specific consumer or make it conditional.
788
+
789
+ **Unrelated content crossfades:** A bare VT uses the browser crossfade for every trigger. Set `default="none"` and opt in only to the triggers that boundary should handle.
790
+
791
+ **Scrolling hangs while a transition animates:** the `::view-transition` overlay is `position: fixed` and its snapshots don't scroll — a browser limitation, not fixable in React (skipping snaps to the end). Keep reveal durations short; for scroll-driven UI use gesture transitions (experimental `useSwipeTransition`, if available).
792
+
793
+ **Open popover flickers when a background transition settles:** it's captured in `root`. Give it a real `view-transition-name` + isolation (not `none`) — see [Isolate Elements from Parent Animations](patterns.md#isolate-elements-from-parent-animations).
794
+
795
+ **Popover closes or goes dead when clicked mid-transition:** named participants are skipped by hit-testing while a transition runs; clicks land on what's beneath and read as outside-clicks. Portal the popover (see [Isolate Elements from Parent Animations](patterns.md#isolate-elements-from-parent-animations)); brief dead clicks during the transition remain — that's the price of the name.
796
+
797
+ **Shared morph silently not firing:** `share` resolved to `none`. Either the VT has `default="none"` with no explicit `share` prop, or `share` is type-keyed and the navigation never adds the type — the link needs `transitionTypes` (or `addTransitionType` in the transition).
798
+
799
+ **Shared morph competes with a page fade:** A fading page exit dissolves the source while it is morphing. Remove that exit or use motion that preserves the shared element's continuity.
800
+
801
+ **An enter animation runs even though Suspense never showed its fallback:** The content-side VT became the topmost entering subtree during navigation. At that call site, add a host DOM element immediately outside `Suspense`. The host suppresses the nested enter during warm navigation but remains mounted so the VT can enter on a later fallback-to-content reveal. Keep the host outside `Suspense`, not inside the reusable crossfade; do nothing when a direct host already exists.
802
+
803
+ **Section below a list teleports instead of gliding:** it's outside any activated boundary, its VT has `default="none"` (which disables `update`), or it isn't an immediate sibling of the changing content. See [Layout Displacement Morph](patterns.md#layout-displacement-morph).
804
+
805
+ **`router.back()` and browser back/forward skip the directional slide:** traversals carry no transition types, so type-keyed maps resolve to `default` — untyped shared-element morphs still apply. Use `router.push()` for typed animations.
806
+
807
+ **`flushSync` skips animations:** Use `startTransition` instead.
808
+
809
+ **Only updates animate (no enter/exit):** Without `<Suspense>`, React treats swaps as updates. Conditionally render the VT itself, or wrap in `<Suspense>`.
810
+
811
+ **Suspense reveal does not animate:** Suspense resolves in a separate transition without navigation types. Use string `enter`/`exit` props rather than a type map.
812
+
813
+ **Layout VT prevents page VTs from animating:** Nested VTs skip their own enter/exit when they mount or unmount as one unit with a parent VT. Keep route boundaries in pages, not a layout wrapping `{children}`. React has experimental upstream `parentEnter`/`parentExit` work ([PR #36690](https://github.com/facebook/react/pull/36690)), but those props are not currently available in the Next.js client runtime; do not recommend them in a Next.js app unless the installed runtime and docs explicitly include them.
814
+
815
+ **Same-route content does not animate with `update`:** Nested VTs can own the mutation before an outer boundary sees it. For a real identity change, use `key` with a stable `name` and `share` instead.
816
+
817
+ **List reorder not animating with `useOptimistic`:** Optimistic values resolve before snapshot. Use committed state for list order.
818
+
819
+ **TS error "Property 'default' is missing":** Type-keyed objects require a `default` key.
820
+
821
+ **Hash fragments cause scroll jumps:** Navigate without hash; scroll programmatically after navigation.
822
+
823
+ **Backdrop-blur flickers:** Use the [Backdrop-Blur Workaround](css-recipes.md#backdrop-blur-workaround).
824
+
825
+ **`border-radius` lost during transitions:** Apply `border-radius` directly to the captured element.
826
+
827
+ **Skeleton controls slide away:** Give matching controls the same `viewTransitionName`.
828
+
829
+ **Batching:** Multiple updates during animation are batched. A→B→C→D becomes B→D.
830
+
831
+ ---
832
+
833
+ # CSS Animation Recipes
834
+
835
+ Ready-to-use CSS for `<ViewTransition>` props. Copy into your global stylesheet.
836
+
837
+ This file contains the complete CSS recipe set for the patterns in this skill. Copy only what the app needs.
838
+
839
+ ---
840
+
841
+ ## Timing Variables
842
+
843
+ ```css
844
+ :root {
845
+ --duration-exit: 150ms;
846
+ --duration-enter: 210ms;
847
+ --duration-move: 400ms;
848
+ }
849
+ ```
850
+
851
+ ### Shared Keyframes
852
+
853
+ ```css
854
+ @keyframes fade {
855
+ from { opacity: 0; }
856
+ to { opacity: 1; }
857
+ }
858
+
859
+ @keyframes slide {
860
+ from { translate: var(--slide-offset); }
861
+ to { translate: 0; }
862
+ }
863
+
864
+ @keyframes slide-y {
865
+ from { transform: translateY(var(--slide-y-offset, 10px)); }
866
+ to { transform: translateY(0); }
867
+ }
868
+ ```
869
+
870
+ ---
871
+
872
+ ## Fade
873
+
874
+ ```css
875
+ ::view-transition-old(.fade-out) {
876
+ animation: var(--duration-exit) ease-in fade reverse;
877
+ }
878
+ ::view-transition-new(.fade-in) {
879
+ animation: var(--duration-enter) ease-out var(--duration-exit) both fade;
880
+ }
881
+ ```
882
+
883
+ Usage: `<ViewTransition enter="fade-in" exit="fade-out" />`
884
+
885
+ Keep the shared fade keyframe opacity-only. If a specific morph needs softness, give that class its own blur keyframe so ordinary content reveals stay crisp.
886
+
887
+ ---
888
+
889
+ ## Slide (Vertical)
890
+
891
+ ```css
892
+ ::view-transition-old(.slide-down) {
893
+ animation:
894
+ var(--duration-exit) ease-out both fade reverse,
895
+ var(--duration-exit) ease-out both slide-y reverse;
896
+ }
897
+ ::view-transition-new(.slide-up) {
898
+ animation:
899
+ var(--duration-enter) ease-in var(--duration-exit) both fade,
900
+ var(--duration-move) ease-in both slide-y;
901
+ }
902
+ ```
903
+
904
+ Usage:
905
+ ```jsx
906
+ <Suspense fallback={<ViewTransition exit="slide-down"><Skeleton /></ViewTransition>}>
907
+ <ViewTransition default="none" enter="slide-up"><Content /></ViewTransition>
908
+ </Suspense>
909
+ ```
910
+
911
+ ---
912
+
913
+ ## Directional Navigation
914
+
915
+ ### Separate Enter/Exit Classes
916
+
917
+ ```css
918
+ ::view-transition-new(.slide-from-right) {
919
+ --slide-offset: 60px;
920
+ animation:
921
+ var(--duration-enter) ease-out var(--duration-exit) both fade,
922
+ var(--duration-move) ease-in-out both slide;
923
+ }
924
+ ::view-transition-old(.slide-to-left) {
925
+ --slide-offset: -60px;
926
+ animation:
927
+ var(--duration-exit) ease-in both fade reverse,
928
+ var(--duration-move) ease-in-out both slide reverse;
929
+ }
930
+
931
+ ::view-transition-new(.slide-from-left) {
932
+ --slide-offset: -60px;
933
+ animation:
934
+ var(--duration-enter) ease-out var(--duration-exit) both fade,
935
+ var(--duration-move) ease-in-out both slide;
936
+ }
937
+ ::view-transition-old(.slide-to-right) {
938
+ --slide-offset: 60px;
939
+ animation:
940
+ var(--duration-exit) ease-in both fade reverse,
941
+ var(--duration-move) ease-in-out both slide reverse;
942
+ }
943
+ ```
944
+
945
+ ### Single-Class Approach
946
+
947
+ ```css
948
+ ::view-transition-old(.nav-forward) {
949
+ --slide-offset: -60px;
950
+ animation:
951
+ var(--duration-exit) ease-in both fade reverse,
952
+ var(--duration-move) ease-in-out both slide reverse;
953
+ }
954
+ ::view-transition-new(.nav-forward) {
955
+ --slide-offset: 60px;
956
+ animation:
957
+ var(--duration-enter) ease-out var(--duration-exit) both fade,
958
+ var(--duration-move) ease-in-out both slide;
959
+ }
960
+
961
+ ::view-transition-old(.nav-back) {
962
+ --slide-offset: 60px;
963
+ animation:
964
+ var(--duration-exit) ease-in both fade reverse,
965
+ var(--duration-move) ease-in-out both slide reverse;
966
+ }
967
+ ::view-transition-new(.nav-back) {
968
+ --slide-offset: -60px;
969
+ animation:
970
+ var(--duration-enter) ease-out var(--duration-exit) both fade,
971
+ var(--duration-move) ease-in-out both slide;
972
+ }
973
+ ```
974
+
975
+ ---
976
+
977
+ ## Shared Element Morph
978
+
979
+ ```css
980
+ ::view-transition-group(.morph) {
981
+ animation-duration: var(--duration-move);
982
+ }
983
+
984
+ ::view-transition-image-pair(.morph) {
985
+ animation-name: via-blur;
986
+ }
987
+
988
+ @keyframes via-blur {
989
+ 30% { filter: blur(3px); }
990
+ }
991
+ ```
992
+
993
+ Usage: `<ViewTransition name={`product-${id}`} share="morph" />`
994
+
995
+ **Note:** Shared element transitions take raster snapshots. For text with significant size differences (e.g., `<h3>` → `<h1>`), the old snapshot gets scaled up, producing a visible ghost artifact. Use `text-morph` for text shared elements.
996
+
997
+ ## Text Morph
998
+
999
+ Avoids raster scaling artifacts on text by hiding the old snapshot and showing the new text at full resolution:
1000
+
1001
+ ```css
1002
+ ::view-transition-group(.text-morph) {
1003
+ animation-duration: var(--duration-move);
1004
+ }
1005
+ ::view-transition-old(.text-morph) {
1006
+ display: none;
1007
+ }
1008
+ ::view-transition-new(.text-morph) {
1009
+ animation: none;
1010
+ object-fit: none;
1011
+ object-position: left top;
1012
+ }
1013
+ ```
1014
+
1015
+ Usage: `<ViewTransition name={`title-${id}`} share="text-morph" />`
1016
+
1017
+ ---
1018
+
1019
+ ## Scale
1020
+
1021
+ ```css
1022
+ ::view-transition-old(.scale-out) {
1023
+ animation: var(--duration-exit) ease-in scale-down;
1024
+ }
1025
+ ::view-transition-new(.scale-in) {
1026
+ animation: var(--duration-enter) ease-out var(--duration-exit) both scale-up;
1027
+ }
1028
+
1029
+ @keyframes scale-down {
1030
+ from { transform: scale(1); opacity: 1; }
1031
+ to { transform: scale(0.85); opacity: 0; }
1032
+ }
1033
+ @keyframes scale-up {
1034
+ from { transform: scale(0.85); opacity: 0; }
1035
+ to { transform: scale(1); opacity: 1; }
1036
+ }
1037
+ ```
1038
+
1039
+ Usage: `<ViewTransition enter="scale-in" exit="scale-out" />`
1040
+
1041
+ ---
1042
+
1043
+ ## Interactivity During Transitions
1044
+
1045
+ The `::view-transition` overlay captures all pointer events. React shrinks it to zero when the root group doesn't animate, but in-flight animations still block clicks. To pass clicks/hover through even while animating:
1046
+
1047
+ ```css
1048
+ ::view-transition {
1049
+ pointer-events: none;
1050
+ }
1051
+ ```
1052
+
1053
+ Trade-offs: clicks can hit live elements under still-moving snapshots, and it only helps **unnamed** content — named participants are skipped by hit-testing for the transition's duration, no CSS override ([csswg#10930](https://github.com/w3c/csswg-drafts/issues/10930)). Weigh that before naming interactive elements; portal named popovers (see [Isolate Elements from Parent Animations](patterns.md#isolate-elements-from-parent-animations)).
1054
+
1055
+ ---
1056
+
1057
+ ## No Root Cross-Fade (Live Root)
1058
+
1059
+ The root cross-fades on every transition, freezing unnamed content behind a stale snapshot — hover and active styles stop rendering until it settles. `::view-transition-new(root)` is a **live** capture, so disabling the root animation keeps unnamed regions rendering (and, with the `pointer-events` recipe above, interactive):
1060
+
1061
+ ```css
1062
+ ::view-transition-old(root) {
1063
+ display: none;
1064
+ }
1065
+ ::view-transition-new(root) {
1066
+ animation: none;
1067
+ }
1068
+ ```
1069
+
1070
+ Named and classed groups still animate — they stack above root. Trade-off: unnamed content swaps instantly, so regions that should fade need their own VT. This also removes the main reason to hand-name static chrome; keep names only for elements that must stack above animating groups.
1071
+
1072
+ Pairs well with enter-only reveals: skip the fallback-exit VT entirely (`<ViewTransition enter="auto" default="none">` around the content, nothing on the skeleton) — the skeleton snaps out live while the content fades in.
1073
+
1074
+ ---
1075
+
1076
+ ## Persistent Element Isolation
1077
+
1078
+ ```css
1079
+ ::view-transition-group(persistent-nav) {
1080
+ animation: none;
1081
+ z-index: 100;
1082
+ }
1083
+ ```
1084
+
1085
+ Layer multiple pinned groups with z-index tiers — chrome at `100`, toasts/overlays that must beat everything at `200`.
1086
+
1087
+ ### Backdrop-Blur Workaround
1088
+
1089
+ For elements with `backdrop-filter`, hide the old snapshot to avoid flash:
1090
+
1091
+ ```css
1092
+ ::view-transition-old(persistent-nav) {
1093
+ display: none;
1094
+ }
1095
+ ::view-transition-new(persistent-nav) {
1096
+ animation: none;
1097
+ }
1098
+ ```
1099
+
1100
+ ### Floating Element Isolation (popovers, menus, tooltips, control clusters)
1101
+
1102
+ Same freeze as persistent chrome. A floating/interactive element left rendered while a background transition runs is otherwise captured in the `root` snapshot and flickers as it settles. Give it a real, unique `view-transition-name` (never `none` — that's the CSS default = no isolation) and:
1103
+
1104
+ ```css
1105
+ ::view-transition-group(popover) {
1106
+ animation: none;
1107
+ z-index: 100;
1108
+ }
1109
+ ::view-transition-old(popover),
1110
+ ::view-transition-new(popover) {
1111
+ animation: none;
1112
+ }
1113
+ ```
1114
+
1115
+ ### Sliding Indicator (tab underline / segmented pill)
1116
+
1117
+ One shared-name indicator morphs between positions. Slide the group; disable old/new so the solid bar slides instead of cross-fading:
1118
+
1119
+ ```css
1120
+ ::view-transition-group(.tab-underline) {
1121
+ animation-duration: 220ms;
1122
+ animation-timing-function: cubic-bezier(0.5, 0, 0.2, 1);
1123
+ }
1124
+ ::view-transition-old(.tab-underline),
1125
+ ::view-transition-new(.tab-underline) {
1126
+ animation: none;
1127
+ height: 100%;
1128
+ }
1129
+ ```
1130
+
1131
+ ---
1132
+
1133
+ ## Reduced Motion
1134
+
1135
+ ```css
1136
+ @media (prefers-reduced-motion: reduce) {
1137
+ ::view-transition-old(*),
1138
+ ::view-transition-new(*),
1139
+ ::view-transition-group(*) {
1140
+ animation-duration: 0s !important;
1141
+ animation-delay: 0s !important;
1142
+ }
1143
+ }
1144
+ ```
1145
+
1146
+ ---
1147
+
1148
+ # View Transitions in Next.js
1149
+
1150
+ ## Setup
1151
+
1152
+ `<ViewTransition>` works in the App Router with no configuration. The bundled React channel includes it, and Next.js navigations run in React Transitions. Do **not** add the old `experimental.viewTransition` flag or install `react@canary` into a Next.js app.
1153
+
1154
+ Read the current [Next.js View Transitions guide](https://nextjs.org/docs/app/guides/view-transitions) and the matching guide under `node_modules/next/dist/docs/` before editing. The installed version is authoritative for flags and API signatures.
1155
+
1156
+ Because every link click is a transition, any VT with `default="auto"` fires on **every** navigation — use `default="none"` to prevent competing animations.
1157
+
1158
+ For unexpected or broken animation behavior, see [troubleshooting.md](troubleshooting.md).
1159
+
1160
+ ---
1161
+
1162
+ ## Next.js Implementation Additions
1163
+
1164
+ When following [implementation.md](implementation.md), apply these additions:
1165
+
1166
+ **Step 4:** Use `transitionTypes` on `<Link>` — see [The `transitionTypes` Prop](#the-transitiontypes-prop-on-nextlink). If the animation depends on dynamic destination content, also see [When Content Must Be Ready](#when-content-must-be-ready).
1167
+
1168
+ **After Step 6:** For same-route dynamic segments (e.g., `/collection/[slug]`), use the `key` + `name` + `share` pattern — see [Same-Route Dynamic Segment Transitions](#same-route-dynamic-segment-transitions).
1169
+
1170
+ ---
1171
+
1172
+ ## Layout-Level ViewTransition
1173
+
1174
+ **Do NOT add a layout-level VT wrapping `{children}` if pages have their own VTs.** A nested VT skips its own enter/exit only when it mounts or unmounts *as one unit* with a parent VT, which is exactly what a layout VT wrapping `{children}` causes — page-level enter/exit will silently not work. Remove the layout VT entirely. Nesting is otherwise fine and sometimes required: a child VT inside a *persistent* parent VT fires enter/exit normally, and two nested boundaries are the intended shape for [shared elements inside list items](../SKILL.md#composing-shared-elements-with-list-identity).
1175
+
1176
+ A bare `<ViewTransition>` in layout works only if pages have **no** VTs of their own.
1177
+
1178
+ **Layouts persist across navigations** — `enter`/`exit` only fire on initial mount, not on route changes. Don't use type-keyed maps in layouts. Because layouts persist, chrome hosted in one (nav, sidebar, player) keeps its state across navigations for free — no `Activity` needed. Reserve `Activity` for in-page show/hide (see [Composing with Activity](patterns.md#composing-with-activity)).
1179
+
1180
+ ---
1181
+
1182
+ ## The `transitionTypes` Prop on `next/link`
1183
+
1184
+ No wrapper component needed, works in Server Components:
1185
+
1186
+ ```tsx
1187
+ <Link href="/products/1" transitionTypes={['transition-to-detail']}>
1188
+ View Product
1189
+ </Link>
1190
+ ```
1191
+
1192
+ Replaces the manual pattern of `onNavigate` + `startTransition` + `addTransitionType` + `router.push()`. Reserve manual `startTransition` for non-link interactions (buttons, forms).
1193
+
1194
+ **Availability:** `transitionTypes` shipped in **Next.js 16.2.0** (it is not gated on the `experimental.viewTransition` flag). If unavailable, use `startTransition` + `addTransitionType` + `router.push()` (see [Programmatic Navigation](#programmatic-navigation)). To check: `grep -r "transitionTypes" node_modules/next/dist/` — if no results, fall back to programmatic navigation.
1195
+
1196
+ ---
1197
+
1198
+ ## When Content Must Be Ready
1199
+
1200
+ A page transition can animate whatever Next.js renders during navigation, including a loading fallback. A shared content-to-content morph only works when the incoming content is ready as the navigation commits; content that has not rendered yet cannot form the incoming half of the pair.
1201
+
1202
+ When an animation depends on dynamic destination content, use Next.js prefetching and caching to make that content available ahead of time. `<Link>` automatically prefetches in production, but the default behavior for dynamic routes may only prefetch a shell or loading boundary. Set `prefetch={true}` to prefetch the full route, and cache the data needed to render the shared content.
1203
+
1204
+ ```tsx
1205
+ <Link href={nextHref} prefetch={true} transitionTypes={['nav-forward']}>
1206
+ Next
1207
+ </Link>
1208
+ ```
1209
+
1210
+ With Cache Components, put reusable route data in a cached scope such as `use cache` so prefetching can include it. If the destination remains behind an unresolved Suspense boundary, the route transition animates the fallback instead. The content resolves in a separate Suspense transition without the original `nav-forward` or `nav-back` type, so give that content its own reveal animation when needed.
1211
+
1212
+ Verify directional transitions in a production build with a cold client cache. Development mode does not run automatic `<Link>` prefetching.
1213
+
1214
+ See the Next.js [View Transitions guide](https://nextjs.org/docs/app/guides/view-transitions) and [Prefetching guide](https://nextjs.org/docs/app/guides/prefetching).
1215
+
1216
+ ---
1217
+
1218
+ ## Programmatic Navigation
1219
+
1220
+ ```tsx
1221
+ 'use client';
1222
+
1223
+ import { useRouter } from 'next/navigation';
1224
+
1225
+ function DetailButton({ href }: { href: string }) {
1226
+ const router = useRouter();
1227
+
1228
+ return (
1229
+ <button onClick={() => router.push(href, { transitionTypes: ['nav-forward'] })}>
1230
+ Open
1231
+ </button>
1232
+ );
1233
+ }
1234
+ ```
1235
+
1236
+ The `transitionTypes` option adds the types inside the router's navigation Transition. Use `startTransition` + `addTransitionType` for non-navigation state updates, or as a fallback on Next.js versions without the router option.
1237
+
1238
+ ---
1239
+
1240
+ ## Server-Side Filtering with `router.replace`
1241
+
1242
+ For search/sort/filter that re-renders on the server (via URL params), use `startTransition` + `router.replace`. VTs activate because the state update is inside `startTransition`:
1243
+
1244
+ ```tsx
1245
+ 'use client';
1246
+
1247
+ import { useRouter } from 'next/navigation';
1248
+ import { startTransition } from 'react';
1249
+
1250
+ function SortControl() {
1251
+ const router = useRouter();
1252
+
1253
+ function handleSort(sort: string) {
1254
+ startTransition(() => {
1255
+ router.replace(`?sort=${sort}`);
1256
+ });
1257
+ }
1258
+
1259
+ return <button onClick={() => handleSort('newest')}>Newest</button>;
1260
+ }
1261
+ ```
1262
+
1263
+ List items wrapped in `<ViewTransition key={item.id}>` will animate reorder. This is the server-component alternative to the client-side [Searchable Grid](patterns.md#searchable-grid-with-usedeferredvalue) pattern.
1264
+
1265
+ For immediate control feedback while the route commits, use `useOptimistic` for the button state but keep the animated list tied to the committed sort value. See [Exclude Elements with `useOptimistic`](patterns.md#exclude-elements-with-useoptimistic).
1266
+
1267
+ ---
1268
+
1269
+ ## Routing-Driven Tabs
1270
+
1271
+ The generalized sliding indicator ([Sliding Indicator](patterns.md#sliding-indicator-tabs)) driven by navigation instead of local state: tabs are `<Link>`s, `active` comes from the URL (a server prop), and `useOptimistic` slides the indicator instantly while the route commits. Key the mounted indicator to committed `active` so the bar lands where navigation actually settles.
1272
+
1273
+ ```tsx
1274
+ 'use client';
1275
+ import Link from 'next/link';
1276
+ import { useOptimistic, useTransition, ViewTransition } from 'react';
1277
+
1278
+ export function Tabs({ tabs, active, indicatorName = 'tab-indicator' }) {
1279
+ const [optimisticActive, setOptimisticActive] = useOptimistic(active);
1280
+ const [, startTransition] = useTransition();
1281
+ return (
1282
+ <nav>
1283
+ {tabs.map(t => (
1284
+ <Link key={t.value} href={t.href} scroll={false}
1285
+ aria-current={optimisticActive === t.value ? 'page' : undefined}
1286
+ onNavigate={() => startTransition(() => setOptimisticActive(t.value))}>
1287
+ <span>{t.label}</span>
1288
+ {active === t.value && (
1289
+ <ViewTransition name={indicatorName} share="tab-underline">
1290
+ <span className="active-underline" aria-hidden />
1291
+ </ViewTransition>
1292
+ )}
1293
+ </Link>
1294
+ ))}
1295
+ </nav>
1296
+ );
1297
+ }
1298
+ ```
1299
+
1300
+ ---
1301
+
1302
+ ## Two-Layer Pattern (Directional + Suspense)
1303
+
1304
+ Directional slides + Suspense reveals coexist because they fire at different moments. Place the directional VT in the **page component** (not layout):
1305
+
1306
+ ```tsx
1307
+ <ViewTransition
1308
+ enter={{ "nav-forward": "slide-from-right", default: "none" }}
1309
+ exit={{ "nav-forward": "slide-to-left", default: "none" }}
1310
+ default="none"
1311
+ >
1312
+ <div>
1313
+ <Suspense fallback={<ViewTransition exit="slide-down"><Skeleton /></ViewTransition>}>
1314
+ <ViewTransition enter="slide-up" default="none"><Content /></ViewTransition>
1315
+ </Suspense>
1316
+ </div>
1317
+ </ViewTransition>
1318
+ ```
1319
+
1320
+ ---
1321
+
1322
+ ## `loading.tsx` as Suspense Boundary
1323
+
1324
+ Next.js `loading.tsx` is an implicit `<Suspense>` boundary. Wrap the skeleton in `<ViewTransition exit="...">` in `loading.tsx`, and the content in `<ViewTransition enter="..." default="none">` in the page:
1325
+
1326
+ ```tsx
1327
+ // loading.tsx
1328
+ <ViewTransition exit="slide-down"><PhotoGridSkeleton /></ViewTransition>
1329
+
1330
+ // page.tsx
1331
+ <ViewTransition enter="slide-up" default="none"><PhotoGrid photos={photos} /></ViewTransition>
1332
+ ```
1333
+
1334
+ Same rules as explicit `<Suspense>`: use simple string props (not type maps) since Suspense reveals fire without transition types.
1335
+
1336
+ ---
1337
+
1338
+ ## Shared Elements Across Routes
1339
+
1340
+ ```tsx
1341
+ // List page
1342
+ {products.map((product) => (
1343
+ <Link key={product.id} href={`/products/${product.id}`} transitionTypes={['nav-forward']}>
1344
+ <ViewTransition name={`product-${product.id}`}>
1345
+ <Image src={product.image} alt={product.name} width={400} height={300} />
1346
+ </ViewTransition>
1347
+ </Link>
1348
+ ))}
1349
+
1350
+ // Detail page — same name
1351
+ <ViewTransition name={`product-${product.id}`}>
1352
+ <Image src={product.image} alt={product.name} width={800} height={600} />
1353
+ </ViewTransition>
1354
+ ```
1355
+
1356
+ If the pair's `share` is type-keyed (or classed via CSS that expects a type), every `<Link>` between the two views must carry the type via `transitionTypes` — a plain link click resolves the share map's `default`, and if that's `none` the morph silently never fires.
1357
+
1358
+ ---
1359
+
1360
+ ## Same-Route Dynamic Segment Transitions
1361
+
1362
+ When navigating between dynamic segments of the same route (e.g., `/collection/[slug]`), the router swaps subtrees keyed by the segment value rather than doing a plain unmount/mount — enter/exit don't fire reliably. Use `key` + `name` + `share`:
1363
+
1364
+ ```tsx
1365
+ <Suspense fallback={<Skeleton />}>
1366
+ <ViewTransition key={slug} name="collection-content" share="auto" default="none">
1367
+ <Content slug={slug} />
1368
+ </ViewTransition>
1369
+ </Suspense>
1370
+ ```
1371
+
1372
+ - `key={slug}` forces unmount/remount on change
1373
+ - The stable `name` pairs the outgoing and incoming containers; `share="auto"` creates the crossfade
1374
+ - VT inside `<Suspense>` (without keying Suspense) keeps old content visible during loading
1375
+
1376
+ ## Server Components
1377
+
1378
+ - `<ViewTransition>` works in both Server and Client Components
1379
+ - `<Link transitionTypes>` works in Server Components — no `'use client'` needed
1380
+ - `router.push(..., { transitionTypes })`, `addTransitionType`, and `startTransition` require Client Components