usePreferredReducedMotion ​
Reactive prefers-reduced-motion media query.
Demo ​
Usage ​
js
import { usePreferredReducedMotion } from '@vueuse/core'
const preferredMotion = usePreferredReducedMotion()
Component Usage ​
This function also provides a renderless component version via the
@vueuse/components
package. Learn more about the usage.
vue
<template>
<UsePreferredReducedMotion v-slot="{ motion }">
Preferred Reduced Motion: {{ motion }}
</UsePreferredReducedMotion>
</template>
Type Declarations ​
typescript
export type ReducedMotionType = "reduce" | "no-preference"
/**
* Reactive prefers-reduced-motion media query.
*
* @see https://vueuse.org/usePreferredReducedMotion
* @param [options]
*/
export declare function usePreferredReducedMotion(
options?: ConfigurableWindow,
): ComputedRef<ReducedMotionType>
Source ​
Contributors ​
Anthony Fu
丶远方
vaakian X
Zhao