Skip to content
On this page

usePreferredReducedMotion

Category
Export Size
1.09 kB
Last Changed
2 months ago

Reactive prefers-reduced-motion media query.

Demo

Preferred Motion:
no-preference

Usage

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.

<UsePreferredReducedMotion v-slot="{ motion }">
  Preferred Color Scheme: {{ motion }}
<UsePreferredReducedMotion>
<UsePreferredReducedMotion v-slot="{ motion }">
  Preferred Color Scheme: {{ motion }}
<UsePreferredReducedMotion>

Type Declarations

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

SourceDemoDocs

Contributors

Changelog

v9.1.0 on 8/4/2022
e808b - feat: new function (#2039)

Released under the MIT License.