Transition Control in Astro
From the Astro cheat sheet · View Transitions · verified Jul 2026
Transition Control
astro
---
import { navigate } from 'astro:transitions/client';
---
<!-- Disable transitions for specific link -->
<a href="/about" data-astro-reload>Full page reload</a>
<!-- Control history behavior -->
<a href="/page" data-astro-history="replace">
Replace history
</a>
<script>
// Programmatic navigation
navigate('/dashboard', {
history: 'push' // or 'replace', 'auto'
});
// Listen to lifecycle events
document.addEventListener('astro:page-load', () => {
console.log('New page loaded');
// Re-initialize scripts
});
</script>✅ navigate() triggers transitions programmatically
💡 data-astro-reload forces full page navigation
🔍 astro:page-load ideal for re-initializing scripts
⚡ Respects prefers-reduced-motion automatically
navigatelifecycleevents