Skip to content

usePreferredReducedMotion ​

Category
Export Size
557 B
Last Changed
2 months ago

Reactive prefers-reduced-motion media query.

Demo ​

Preferred Motion:
no-preference

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 ​

Source • Demo • Docs

Contributors ​

Anthony Fu
Anthony Fu
丶远方
vaakian X
Zhao

Changelog ​

v9.11.0 on 1/17/2023
d5321 - fix(components): mark defineComponent as pure (#2623)

Released under the MIT License.