Zum Inhalt springen
Skillpedia
Websites & UI (Frontend)33k · #8432

vercel-react-view-transitions

Was er macht

Dieser Skill hilft dabei, animierte Übergänge zwischen Bildschirmen und Zuständen in React-Apps einzubauen. Er ist für Frontend-Entwickler gedacht, die saubere Bewegung ohne schweren Animationscode wollen.

Wann du ihn nutzt

  • ✓Wenn du eine flüssige Animation beim Wechsel zwischen Seiten oder Routen willst.
  • ✓Wenn ein Element aus einer Liste heraus in seine Detailansicht animieren soll.
  • ✓Wenn Listenelemente animiert werden sollen, wenn sie umsortiert oder hinzugefügt werden.

Link zum Skill

https://github.com/vercel-labs/agent-skills/blob/main/skills/react-view-transitions/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/vercel-labs/agent-skills/blob/main/skills/react-view-transitions/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Füge einen flüssigen Übergang hinzu, wenn ein Nutzer eine Produktkarte antippt und die Detailseite öffnet.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Er nutzt eine ViewTransition-Komponente, um festzulegen, was animiert werden soll, und startet die Änderung mit Transition-Hooks. Das Styling wird über CSS-Klassen gesetzt, und Browser ohne Unterstützung überspringen die Animation sicher.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

React View Transitions

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.

When to Animate

Every <ViewTransition> should communicate a spatial relationship or continuity. If you can't articulate what it communicates, don't add it.

Implement all applicable patterns from this list, in this order:

Priority Pattern What it communicates
1 Shared element (name) "Same thing — going deeper"
2 Suspense reveal "Data loaded"
3 List identity (per-item key) "Same items, new arrangement"
4 State change (enter/exit) "Something appeared/disappeared"
5 Route change (page-level) "Going to a new place"

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.

Choosing Animation Style

Context Animation Why
Hierarchical navigation (list → detail) Type-keyed nav-forward / nav-back Communicates spatial depth
Lateral navigation (tab-to-tab) Bare <ViewTransition> (fade) or default="none" No depth to communicate
Suspense reveal enter/exit string props Content arriving
Revalidation / background refresh default="none" Silent — no animation needed

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.


Availability

  • 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.
  • 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.
  • Browser support: Chromium 125+ (React needs the v2 object form of startViewTransition), Firefox 144+, Safari 18.2+. Graceful degradation on unsupported browsers.

Implementation Workflow

When adding view transitions to an existing app, follow references/implementation.md step by step. Start with the audit — do not skip it. Use references/css-recipes.md for the applicable CSS and adapt it to the app.


Core Concepts

The <ViewTransition> Component

import { ViewTransition } from 'react';

<ViewTransition>
  <Component />
</ViewTransition>

React auto-assigns a unique view-transition-name and calls document.startViewTransition behind the scenes. Never call startViewTransition yourself.

Animation Triggers

Trigger When it fires
enter <ViewTransition> first inserted during a Transition
exit <ViewTransition> first removed during a Transition
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
share Named VT unmounts and another with same name mounts in the same Transition

Only startTransition, useDeferredValue, or Suspense activate VTs. Regular setState does not animate.

Critical Placement Rule

<ViewTransition> only activates enter/exit if it appears before any DOM nodes:

// Works
<ViewTransition enter="auto" exit="auto">
  <div>Content</div>
</ViewTransition>

// Broken — div wraps the VT, suppressing enter/exit
<div>
  <ViewTransition enter="auto" exit="auto">
    <div>Content</div>
  </ViewTransition>
</div>

Styling with View Transition Classes

Props

Values: "auto" (browser cross-fade), "none" (disabled), "class-name" (custom CSS), or { [type]: value } for type-specific animations.

<ViewTransition default="none" enter="slide-in" exit="slide-out" share="morph" />

If default is "none", all trigge

Häufige Fragen

Funktionieren ältere Browser dann nicht?

Doch. Browser ohne Unterstützung für die View-Transition-API überspringen die Animation ohne Fehler.

Soll jedes Element animiert werden?

Nein. Jede Animation sollte einen klaren Zusammenhang zeigen, sonst wird sie nicht hinzugefügt.

Wie wird der Stil gesteuert?

Über CSS-Klassen und die Pseudo-Elemente der View Transition.

Details

Originalbeschreibung des Autors

Guide for implementing smooth, native-feeling animations using React's View Transition API (`<ViewTransition>` component, `addTransitionType`, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter/exit of components, animate list reorder, implement directional (forward/back) navigation animations, or integrate view transitions in Next.js. Also use when the user mentions view transitions, `startViewTransition`, `ViewTransition`, transition types, or asks about animating bet

repo: vercel-labs/agent-skills

Beliebtheit

GitHub-Sterne
33k
Platz im Ranking
#8432
Lizenz
—
Aktualisiert
28.10.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills