trove-react-view-transitions
Implement smooth, native-feeling animations with React's View Transition API (the `ViewTransition` component, `addTransitionType`, CSS view-transition pseudo-elements). Use for page transitions, shared element morphs, Suspense reveals, list identity, or animating between React UI states without a third-party animation library.
- License 许可
- MIT
- 所属仓库
- bravew/trove
- 最近更新
- 2026-11-12
- Stars
- ★ 10
- Forks
- 1
01 前言 Front Matter
- name
- trove-react-view-transitions
- license
- MIT
- metadata
- { "source": "vercel-labs/agent-skills", "trove-category": "code", "upstream-version": "1.0.0", "trove-category-label": "Code" }
- description
- Implement smooth, native-feeling animations with React's View Transition API (the `ViewTransition` component, `addTransitionType`, CSS view-transition pseudo-elements). Use for page transitions, shared element morphs, Suspense reveals, list identity, or animating between React UI states without a third-party animation library.
- when_to_use
- view transition; shared element animation; page transition; startViewTransition
- user-invocable
- true
02 资源文件 4
- 参考文档references/css-recipes.md5.1 KB
- 参考文档references/implementation.md9.9 KB
- 参考文档references/nextjs.md6.3 KB
- 参考文档references/patterns.md8.2 KB
03 SKILL.md 正文
<!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly --> <!-- Regenerate: bun run build:skills -->
Session Init
This skill ships Trove conventions. Prefer existing project patterns over generic best practices when they conflict.
React View Transitions
Animate between UI states using the browser's native View Transition API.
Declare what animates with <ViewTransition>, trigger when with
startTransition, useDeferredValue, or Suspense, and control how with CSS
classes from references/css-recipes.md. Unsupported browsers skip animations.
Stack Notes
This skill assumes a Vite-based React app (React Router, not Next.js
App Router). <ViewTransition> and addTransitionType are stable in React 19.3,
so use react and react-dom 19.3 or newer and verify with npm ls react.
Earlier stable versions do not include these APIs. The references/nextjs.md
file is only for future Next.js work.
Load On Demand
references/implementation.md- required workflow when adding transitions.references/css-recipes.md- CSS recipes to copy into the global stylesheet.references/patterns.md- examples, events API, timing, and troubleshooting.references/nextjs.md- Next.js App Router reference only.
Do not inline those references into the conversation. Load the relevant file when the implementation step needs it.
When To Animate
Every transition must communicate continuity or spatial relationship. If you cannot name what the motion communicates, skip it.
Apply every fitting pattern in this order:
| Priority | Pattern | Communicates |
|---|---|---|
| 1 | Shared element (name) |
Same thing, going deeper |
| 2 | Suspense reveal | Data loaded |
| 3 | List identity (key) |
Same items, new arrangement |
| 4 | State change (enter/exit) |
Something appeared/disappeared |
| 5 | Route change | Going to a new place |
Use directional slides only for hierarchy or ordered sequences. Lateral tabs should use a cross-fade or no animation.
Implementation Workflow
- Load
references/implementation.mdand start with the audit. Map every<Link>, router navigation,<Suspense>boundary, page component, persistent element, and shared visual element. - Copy the complete CSS recipe set from
references/css-recipes.mdinto the global stylesheet before wiring components. - Isolate persistent headers, navbars, sidebars, sticky controls, and matching
skeleton/content controls with
viewTransitionName. - For hierarchical route changes, tag direction with
addTransitionTypeinsidestartTransition, then wrap page components, not layouts, in a type-keyed<ViewTransition>. - For Suspense, wrap fallback and content separately. Use string props, not type maps; Suspense resolves fire as separate transitions without route type.
- For shared elements, use globally unique
namevalues such asphoto-${id}and add fallbackenter/exitwhen a pair might not form. - Verify every row in the navigation map: mount/unmount behavior, named-pair
formation,
default="none", persistent element isolation, and reduced motion.
Non-Negotiable Rules
- Only
startTransition,useDeferredValue, orSuspenseactivate React view transitions. RegularsetStatedoes not animate. <ViewTransition>must appear before any DOM node it needs to animate. Wrapping the VT inside a<div>suppresses enter/exit.- Use
default="none"and explicit triggers. Bare VTs cross-fade on every transition, including revalidation and background updates. - Type-keyed props must include
default: "none"unless broad cross-fades are intentional. - Pair
enterwithexit; otherwise the old page vanishes while the new one animates. - Never use a fade-out exit on pages with shared morphs. Use a directional exit so the morph stays visually coherent.
router.back()and browser back/forward do not trigger view transitions; navigate to an explicit URL instead.- Nested VTs inside an exiting parent do not run their own enter/exit. Avoid layout-level wrappers around page content.
Verification
Run the app and inspect the real transitions, including reduced-motion mode. Check desktop and mobile viewports. Confirm that unsupported browsers degrade to no animation rather than broken layout or invisible content.
Source
Upstream: vercel-labs/agent-skills react-view-transitions (MIT). Adapted
for the Trove marketplace.
04 同仓库更多 Skills
using-trove
Skill discipline anchor for the Trove marketplace. Loaded once per session; routes the agent to the right trove-* skill before code, planning, review, or git actions.
trove-write-skill
Skill authoring workflow. Use when creating or updating a Codex or Trove skill, including rubrics, tasks, metadata, and validation.
trove-worktree
Git worktree workflow for spikes, risky experiments, and broad refactors that should not disturb the user's current branch.
trove-why
Reconstruct design rationale and decision history from evidence — source control, issue tracker (Linear), docs (Notion), chat (Slack), error tracking (Sentry) — with calibrated confidence. Use for "why does X work this way", "why did we pick Y", regressions, and postmortems. Use trove-explain for how it works now.
trove-verify
Completion verification workflow. Use before claiming done, fixed, complete, ready, or shipped.
trove-unslop
Cut AI tells from writing — PR descriptions, release notes, specs, commit bodies, and replies. Use before finalizing prose, or when the user asks to clean up, de-slop, or make text sound human.