Skip to content

usePreferredReducedTransparency ​

Category
Export Size
Last Changed
3 hours ago

Reactive prefers-reduced-transparency media query.

Demo ​

Preferred Transparency:
no-preference

Usage ​

js
import { usePreferredReducedTransparency } from '@vueuse/core'

const preferredTransparency = usePreferredReducedTransparency()

Component Usage ​

This function also provides a renderless component version via the @vueuse/components package. Learn more about the usage.

vue
<template>
  <UsePreferredReducedTransparency v-slot="{ transparency }">
    Preferred Reduced transparency: {{ transparency }}
  </UsePreferredReducedTransparency>
</template>

Type Declarations ​

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

Source ​

Source • Demo • Docs

Contributors ​

huiliangShen

Changelog ​

v12.2.0-beta.1 on 12/23/2024
34cd7 - feat: add new function (#4201)

Released under the MIT License.