Skip to content

useFileDialog

Category

Open file dialog with ease.

Demo

Usage

ts
import { useFileDialog } from '@hungpvq@shared-core';

const { files, open, reset, onChange } = useFileDialog({
  accept: 'image/*', // Set to accept only image files
  directory: true, // Select directories instead of files if set true
});

onChange((files) => {
  /** do something with files */
});
vue
<template>
  <button type="button" @click="open">Choose file</button>
</template>