apps/ui-library/content/docs/nuxtjs/dropzone.mdx
<ComponentPreview name="dropzone-demo" description="A file upload dropzone component that allows users to drag-and-drop files or select them manually. It supports multiple files, displays upload progress, previews images, and shows validation errors." showCode={false} />
<BlockItem name="dropzone-nuxtjs" description="Displays a control for easier uploading of files directly to Supabase Storage" />
This block assumes that you have already installed a Supabase client for Nuxt from the previous step.
<RegistryBlock itemName="dropzone-nuxtjs" />Uploading files should be easy—this component handles the tricky parts for you.
The File Upload component makes it easy to add file uploads to your app, with built-in support for drag-and-drop, file type restrictions, image previews, and configurable limits on file size and number of files. All the essentials, ready to go.
Features
<Dropzone /> component to your page and it will handle the rest.<script setup>
import { Dropzone, DropzoneContent, DropzoneEmptyState } from '@/components/dropzone'
import { useSupabaseUpload } from '@/composables/use-supabase-upload'
const upload = useSupabaseUpload({
bucketName: 'test',
path: 'test',
allowedMimeTypes: ['image/*'],
maxFiles: 2,
maxFileSize: 1000 * 1000 * 10, // 10MB,
})
</script>
<template>
<Dropzone v-bind="upload">
<DropzoneEmptyState />
<DropzoneContent />
</Dropzone>
</template>
| Prop | Type | Default | Description |
|---|---|---|---|
bucketName | string | null | The name of the Supabase Storage bucket to upload to |
path | string | null | The path or subfolder to upload the file to |
allowedMimeTypes | string[] | [] | The MIME types to allow for upload |
maxFiles | number | 1 | Maximum number of files to upload |
maxFileSize | number | Infinity | Maximum file size in bytes |