usePreferredReducedMotion
Reactive prefers-reduced-motion media query.
Demo
Usage
js
import { usePreferredReducedMotion } from '@vueuse/core'
const preferredMotion = usePreferredReducedMotion()
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.
html
<UsePreferredReducedMotion v-slot="{ motion }">
Preferred Color Scheme: {{ motion }}
<UsePreferredReducedMotion>
<UsePreferredReducedMotion v-slot="{ motion }">
Preferred Color Scheme: {{ motion }}
<UsePreferredReducedMotion>
Type Declarations
typescript
export declare 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>
export declare 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
Zhao