View Transitions
Page transitions · Shared element transitions · Transizioni di pagina
Smooth transitions between two states or pages, where a shared element morphs from one position to the next. Now a native browser API.
- Era
- 2023 – today
- Use
- Mainstream
Live demo
View code
<div id="app" class="list">
<div class="tile" style="--c:#6366F1">A</div><div class="tile" style="--c:#F59E0B">B</div><div class="tile" style="--c:#10B981">C</div>
</div>
<p class="hint">Clicca un riquadro</p>
<script>
const app=document.getElementById('app');
const tiles=[...app.querySelectorAll('.tile')];
const flip=t=>{const go=()=>{tiles.forEach(x=>x.classList.toggle('open',x===t&&!t.classList.contains('open')));app.classList.toggle('detail',t.classList.contains('open'))};
document.startViewTransition?document.startViewTransition(go):go();};
let auto=true,k=0;
tiles.forEach((t,i)=>{t.style.viewTransitionName='t'+i;t.onclick=()=>{auto=false;flip(t)}});
// Senza clic la demo apre e chiude da sola un riquadro alla volta.
if(matchMedia('(prefers-reduced-motion: no-preference)').matches)setInterval(()=>{if(!auto)return;const open=tiles.find(x=>x.classList.contains('open'));flip(open||tiles[k++%tiles.length])},1600);
</script> body{background:#F9FAFB;font-family:'Plus Jakarta Sans',sans-serif;display:grid;place-items:center;align-content:center}
#app{display:flex;gap:14px;width:360px;height:220px;align-items:center;justify-content:center}
.tile{width:90px;height:90px;border-radius:18px;background:var(--c);color:#fff;font-weight:800;font-size:28px;display:grid;place-items:center;cursor:pointer}
.detail .tile:not(.open){display:none}
.tile.open{width:340px;height:210px;font-size:64px;border-radius:28px}
.hint{color:#6b7280;margin:8px 0 0;font-size:13px}
::view-transition-group(*){animation-duration:.4s;animation-timing-function:cubic-bezier(.4,0,.2,1)} Characteristics
- document.startViewTransition()
- view-transition-name for shared elements
- Automatic cross-fade for the rest
- Works across pages too (MPA)
- Spatial continuity from list to detail
Palette
Click a swatch to copy it
Typography
Headings · Plus Jakarta Sans View Transitions
Body · Plus Jakarta Sans Smooth transitions between two states or pages, where a shared element morphs from one position to the next. Now a native browser API.
Motion
- Easing
cubic-bezier(0.4, 0, 0.2, 1)- Typical duration
- 250–450 ms
- Techniques
- View Transitions API, @view-transition { navigation: auto }, FLIP, Framer Motion layoutId
Accessibility (reduced motion)
Use a plain cross-fade, or disable the transition under @media (prefers-reduced-motion).
Prompt for your agent
Copy and paste into your prompt to have an agent or image generator reproduce this style.
For web pages and UI
Design the web page or interface in this style: View Transitions (Page transitions, Shared element transitions).
Smooth transitions between two states or pages, where a shared element morphs from one position to the next. Now a native browser API.
Characteristics: document.startViewTransition(), view-transition-name for shared elements, Automatic cross-fade for the rest, Works across pages too (MPA), Spatial continuity from list to detail.
Palette: #111827, #F9FAFB, #6366F1, #F59E0B, #10B981.
Typography: headings in Plus Jakarta Sans, body text in Plus Jakarta Sans (Google Fonts or equivalents).
Mood: clean, immersive, subtle.
Motion: easing cubic-bezier(0.4, 0, 0.2, 1), typical duration 250–450 ms; techniques: View Transitions API, @view-transition { navigation: auto }, FLIP, Framer Motion layoutId.
With prefers-reduced-motion: Use a plain cross-fade, or disable the transition under @media (prefers-reduced-motion).
References: MDN View Transitions API, Chrome Developers, Astro View Transitions. Relations
References
- MDN View Transitions API
- Chrome Developers
- Astro View Transitions