vercel-react-view-transitions
Skill này làm gì
Công cụ này giúp tạo hoạt ảnh mượt mà khi chuyển giữa các phần của website xây dựng bằng React hoặc Next.js. Các phần tử di chuyển liên kết với nhau giữa các màn hình, như thể chúng là cùng một đối tượng đang đổi chỗ.
Khi nào nên dùng
- ✓Khi chuyển từ danh sách các mục sang chi tiết của một mục.
- ✓Khi chuyển đổi giữa các tab hoặc phần khác nhau.
- ✓Khi dữ liệu mới được tải và màn hình cần cập nhật với hiệu ứng.
Liên kết skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/vercel-react-view-transitions/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tạo hoạt ảnh mượt khi người dùng nhấn vào một sản phẩm trong danh sách và chuyển sang trang chi tiết.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Công cụ dùng một công nghệ trình duyệt gọi là `document.startViewTransition` để chụp ‘ảnh’ màn hình trước và sau khi thay đổi. Sau đó, nó dùng các lớp CSS để tạo hoạt ảnh chuyển đổi giữa các ảnh này, kết nối các phần tử thay đổi.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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 Use
- Use this skill when the task matches this description: Guide React and Next.js view transitions, shared element animations, route transitions, transition types, and reduced-motion-safe UI state animation.
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 (layout-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.ViewTransitionworks out of the box.npm ls reactmay show a stable-looking version; this is expected. - Without Next.js: Install
react@canary react-dom@canary(ViewTransitionis not in stable React). - Browser support: Chromium 111+, 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. Copy the CSS recipes from references/css-recipes.md into the global stylesheet — do not write your own animation CSS.
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>. 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" />
…
Câu hỏi thường gặp
Tôi có cần cài thêm gì không?
Nếu bạn dùng Next.js thì không cần cài thêm gì. Nếu không dùng Next.js, bạn cần cài các phiên bản React cụ thể (`react@canary` và `react-dom@canary`).
‘Shared element animations’ (hoạt ảnh phần tử chung) là gì?
Đó là các hoạt ảnh trong đó cùng một phần tử (như hình ảnh hoặc tiêu đề) xuất hiện trên hai màn hình khác nhau, và hoạt ảnh nối phiên bản cũ với phiên bản mới, tạo cảm giác liền mạch.
Nếu trình duyệt của người dùng không hỗ trợ thì sao?
Hoạt ảnh đơn giản sẽ không chạy, và website vẫn hoạt động bình thường. Nó không làm hỏng trải nghiệm người dùng.
Chi tiết
Mô tả gốc của tác giả
Guide React and Next.js view transitions, shared element animations, route transitions, transition types, and reduced-motion-safe UI state animation.
Độ phổ biến
- Sao GitHub
- 48k
- Vị trí xếp hạng
- #6106
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
00-andruia-consultant
48kGiúp agent của bạn bắt đầu hoặc cải thiện các dự án AI. Phân tích mã, gợi ý công cụ và lập kế hoạch hành động bằng tiếng Tây Ban Nha.
007
48kCho phép agent của bạn thực hiện kiểm toán bảo mật và mô hình hóa mối đe dọa. Hữu ích để bảo vệ dự án khỏi các cuộc tấn công và lỗ hổng.
10-andruia-skill-smith
48kGiúp agent của bạn tạo hoặc cải thiện các công cụ AI. Xác định cách công cụ hoạt động, viết tài liệu và kiểm tra cấu trúc.
20-andruia-niche-intelligence
48kGiúp agent của bạn tạo bản tóm tắt về một ngành cụ thể. Hữu ích để hiểu bối cảnh, quy tắc, cách người dùng tương tác và rủi ro của dự án.
Skill tương tự
angular-developer
280kGiúp agent của bạn viết code Angular và tư vấn cấu trúc dự án, hữu ích khi bắt đầu dự án mới hoặc cải thiện hiệu suất.
frontend-a11y
280kGiúp agent của bạn làm cho giao diện web dễ tiếp cận với mọi người. Đảm bảo website và ứng dụng hoạt động tốt với trình đọc màn hình và điều hướng bằng bàn phím.
frontend-patterns
280kGiúp agent của bạn áp dụng các mẫu hiện đại trong phát triển frontend. Tối ưu hiệu năng, quản lý trạng thái và tuân theo thực hành tốt nhất với React và Next.js.