Skip to main content
cngx-src documentation

provideMotion

Functioncore/themingv0.1.0

projects/core/theming/motion.ts

Description#

Install the motion preference at app root and reflect it onto <html data-motion>, driving the reduced-motion safety net in motion-tokens.css. Unlike the density reflector, this one removes the attribute for 'auto' so the OS prefers-reduced-motion media query stays in charge, and sets it for 'reduced' / 'full'. The reflector is an effect (not afterNextRender) so it re-runs on every runtime injectMotion().set(...); the DOM write is wrapped in untracked() per the signal-architecture rules.

bootstrapApplication(AppComponent, {
  providers: [provideMotion('reduced')],
});

Signature#

provideMotion(initial: CngxMotionPreference)

Parameters#

@paraminitialCngxMotionPreference= 'auto'

Returns#

EnvironmentProviders