Skip to content

UseMatchesMedia

katanakit-js / useMatchesMedia

function useMatchesMedia(query): boolean;

Defined in: infrastructure/viewport/viewport.service.ts:56

Tests a CSS media query against the current viewport.

Parameter Type Description
query string A CSS media query string (e.g. "(min-width: 768px)").

boolean

true if the query matches.

if (useMatchesMedia("(prefers-reduced-motion: reduce)")) {
// disable animations
}