Page Transition

Page Transition

Automatic fade transition on every SPA navigation. Zero-config, SSR-aware, and requires no changes to individual pages.

How it works

PageTransition subscribes to NavigationManager.LocationChanged and uses a Blazor key to re-mount its content on each navigation, triggering Motion's OnAppear animation.

1 — First load

Content appears instantly. Animations are suppressed during SSR, prerendering, and hydration.

2 — URL changes

LocationChanged fires. The render key flips to the new URI, unmounting the old content.

3 — New content animates in

Motion plays the configured fade (and optional slide) as the new content mounts.

Basic usage

Wrap the layout Body in your MainLayout inside RenderStateProvider. That's all that's needed.

@* MainLayout.razor *@
<RenderStateProvider>
    <PageTransition>
        @Body
    </PageTransition>
</RenderStateProvider>

With slide

EnableSlide adds an upward drift on top of the fade, giving a subtle lift feel.

<PageTransition EnableSlide="true" SlideDistance="16" Duration="0.3">
    @Body
</PageTransition>

Parameters

Parameter Type Default Description
Durationdouble0.25Transition duration in seconds
FromOpacitydouble0Starting opacity (0–1)
ToOpacitydouble1Ending opacity (0–1)
EnableSlideboolfalseAdd an upward slide on top of the fade
SlideDistanceint10Slide distance in pixels (used when EnableSlide is true)
DisableAnimationboolfalseSuppress all animations
Classstring?CSS classes applied to the wrapper element
RenderContextAppRenderContext?CascadedProvided automatically by RenderStateProvider

PageTransition vs ScreenTransition

Two complementary tools — use them together.

PageTransition

  • Automatic — fires on every URL change
  • Lives in MainLayout, wraps @Body
  • Fade only (+ optional slide up)
  • No direction concept

ScreenTransition

  • Manual — parent sets Direction + Key
  • Lives inside a shell component
  • Tab (fade) / Push (→) / Pop (←)
  • For mini-apps and nested navigation

Reconnecting...

Attempting to rejoin the server

Connection Lost

Retrying in seconds

Connection Failed

Failed to rejoin the server.
Please retry or reload the page.

Session Paused

The session has been paused by the server

Resume Failed

Failed to resume the session.
Please reload the page.