View transitions

setViewTransitions

Enable or disable wrapping navigations in document.startViewTransition at runtime.

setViewTransitions(enabled)

import { setViewTransitions } from 'manicjs';
import { setViewTransitions } from 'manicjs/transitions';
import { setViewTransitions } from 'manicjs/router';

All three entry points resolve to the same implementation.


Signature

function setViewTransitions(enabled: boolean): void;

Usage

if (matchMedia('(prefers-reduced-motion: reduce)').matches) {
  setViewTransitions(false);
}

Pair with router.viewTransitions: false in manic.config.ts when you need a global default (Configuration).


Framework context

The router reads an internal boolean before calling document.startViewTransition. Disabling transitions avoids animation work for accessibility without rewriting Link components.


See also

On this page