Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/useEyeDropper.md
1---2category: Browser3---45# useEyeDropper67Reactive [EyeDropper API](https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper_API)89## Usage1011```ts12import { useEyeDropper } from '@vueuse/core'1314const { isSupported, open, sRGBHex } = useEyeDropper()15```1617## Component Usage1819```vue20<template>21<UseEyeDropper v-slot="{ isSupported, sRGBHex, open }">22<button :disabled="!isSupported" @click="() => open()">23sRGBHex: {{ sRGBHex }}24</button>25</UseEyeDropper>26</template>27```2829## Type Declarations3031```ts32export interface EyeDropperOpenOptions {33/**34* @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal35*/36signal?: AbortSignal37}38export interface EyeDropper {39new (): EyeDropper40open: (options?: EyeDropperOpenOptions) => Promise<{41sRGBHex: string42}>43[Symbol.toStringTag]: "EyeDropper"44}45export interface UseEyeDropperOptions {46/**47* Initial sRGBHex.48*49* @default ''50*/51initialValue?: string52}53export interface UseEyeDropperReturn extends Supportable {54sRGBHex: ShallowRef<string>55open: (openOptions?: EyeDropperOpenOptions) => Promise<56| {57sRGBHex: string58}59| undefined60>61}62/**63* Reactive [EyeDropper API](https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper_API)64*65* @see https://vueuse.org/useEyeDropper66*67* @__NO_SIDE_EFFECTS__68*/69export declare function useEyeDropper(70options?: UseEyeDropperOptions,71): UseEyeDropperReturn72```73