useFileDialog
Open file dialog with ease.
Demo
Usage
import { useFileDialog } from '@vueuse/core'
const { files, open, reset } = useFileDialog()
import { useFileDialog } from '@vueuse/core'
const { files, open, reset } = useFileDialog()
<template>
<button type="button" @click="open">Choose file</button>
</template>
<template>
<button type="button" @click="open">Choose file</button>
</template>
Type Declarations
export interface UseFileDialogOptions extends ConfigurableDocument {
/**
* @default true
*/
multiple?: boolean
/**
* @default '*'
*/
accept?: string
/**
* Select the input source for the capture file.
* @see [HTMLInputElement Capture](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/capture)
*/
capture?: string
}
export interface UseFileDialogReturn {
files: Ref<FileList | null>
open: (localOptions?: Partial<UseFileDialogOptions>) => void
reset: () => void
}
/**
* Open file dialog with ease.
*
* @see https://vueuse.org/useFileDialog
* @param options
*/
export declare function useFileDialog(
options?: UseFileDialogOptions
): UseFileDialogReturn
export interface UseFileDialogOptions extends ConfigurableDocument {
/**
* @default true
*/
multiple?: boolean
/**
* @default '*'
*/
accept?: string
/**
* Select the input source for the capture file.
* @see [HTMLInputElement Capture](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/capture)
*/
capture?: string
}
export interface UseFileDialogReturn {
files: Ref<FileList | null>
open: (localOptions?: Partial<UseFileDialogOptions>) => void
reset: () => void
}
/**
* Open file dialog with ease.
*
* @see https://vueuse.org/useFileDialog
* @param options
*/
export declare function useFileDialog(
options?: UseFileDialogOptions
): UseFileDialogReturn
Source
Contributors
ZHAO Jinxiang
Max
Anthony Fu
Robert Soriano