Skip to content

usePreferredReducedMotion

Category
Export Size
1.22 kB
Last Changed
3 weeks ago

Reactive prefers-reduced-motion media query.

Demo

Preferred Motion:
no-preference

Usage

ts
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

ts
export type 
ReducedMotionType
= "reduce" | "no-preference"
/** * Reactive prefers-reduced-motion media query. * * @see https://vueuse.org/usePreferredReducedMotion * @param [options] * * @__NO_SIDE_EFFECTS__ */ export declare function
usePreferredReducedMotion
(
options
?:
ConfigurableWindow
,
):
ComputedRef
<
ReducedMotionType
>

Source

SourceDemoDocs

Contributors

Anthony Fu
SerKo
Anthony Fu
丶远方
vaakian X
Zhao

Changelog

v13.6.0 on
d32f8 - refactor: add @__NO_SIDE_EFFECTS__ annotations to all pure functions (#4907)
v12.0.0-beta.1 on
0a9ed - feat!: drop Vue 2 support, optimize bundles and clean up (#4349)

Released under the MIT License.

FREE WEEKEND
48 Hours of Unlimited Official Vue.js Certification Training
Reserve Your Spot
23-24 August