Module

server.view_transitions

View Transitions bridge — tiered setup for the View Transitions API.

Three modes controlled byAppConfig.view_transitions:

  • False / "off"— inject nothing (default).
  • True / "htmx"— inject only the script snippet so htmx swaps animate via the same-document View Transitions API (baseline in all browsers since October 2025).
  • "full"— inject both the head snippet (MPA cross-document transitions) and the script snippet. Cross-document transitions are not yet baseline (no Firefox support as of early 2026).

Head snippet ("full" only, before </head>):

  • <meta name="view-transition" content="same-origin">— enables the browser's native cross-document View Transitions API.
  • @view-transition { navigation: auto; }— CSS at-rule that opts the page into automatic cross-document transitions.
  • Default crossfade keyframes (chirp-vt-out / chirp-vt-in) on the roottransition name. Apps can override with their own view-transition-nameCSS for per-element transitions.

Script snippet ("htmx" and "full", before </body>):

  • Setshtmx.config.globalViewTransitions = trueso every htmx swap automatically uses the View Transitions API when available.
  • Idempotent guard (window.__chirpViewTransitions) prevents double-init.
  • Deferred listener (htmx:load) handles the case where htmx loads after the script (e.g.,<script defer>).

Injected into full-page HTML responses viaHTMLInjectmiddleware.

Functions

normalize_view_transitions 1 ViewTransitionMode
Canonicalize the ``view_transitions`` config value. Returns one of ``"off"``, …
def normalize_view_transitions(value: bool | str) -> ViewTransitionMode

Canonicalize theview_transitionsconfig value.

Returns one of"off", "htmx", or "full".

Parameters
Name Type Description
value bool | str
Returns
ViewTransitionMode