Skip to content

usePreferredReducedMotion ​

Category
Export Size
1.22 kB
Last Changed
4 days 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 ​

Source • Demo • Docs

Contributors ​

NoiseFan

Changelog ​

No recent changes

Released under the MIT License.