Skip to content

usePreferredReducedMotion

Category
Export Size
557 B
Last Changed
6 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

SourceDemoDocs

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.

Conference Offer
Get 50% OFF the Yearly or Lifetime Plan
Access 1450+ lessons on Vue, Pinia, Vite, Tailwind + more
Get Offer
15
hours
:
10
minutes
:
15
seconds
: