View Transitions
Add <ViewTransitions /> to a shared layout to animate full-page navigations via the browser's cross-document View Transitions API — no client router. The card animates while the video below is held still and keeps playing across the navigation, resuming at the same timestamp.
Page 1
Each navigation is a full page load — the browser animates it with a flip transition.
<script lang="ts">
import { url } from 'mochi-framework';
import { ViewTransitions } from 'mochi-framework/components';
import TransitionCard from './TransitionCard.svelte';
const type = parseTransition(url.searchParams.get('type'));
</script>
<ViewTransitions {type} regions="card" />
<TransitionCard page={1} {type} />
More demos
Error Handling Catch render errors and unmatched routes via Mochi.serve()’s errorPage option and the handleError hook. Custom Transitions Bring your own @keyframes to <ViewTransitions /> via custom={{ in, out }} — here, a funky 3D spin. Shared Props Nine islands, three unique payloads — each set serialized once and referenced via props-ref.