Basic UI
  • Docs
  • Compressor
  • Parser
Getting Started
  • Introduction
  • Themenew
Components
  • Button
  • Button Group
  • Badge
  • Radio Group
  • Checkbox
  • Avatar
  • Label
  • File Dropzone
  1. Docs/
  2. Components/
  3. File Dropzone

File Dropzone

Previous page

Accessible drag-and-drop uploader with keyboard support, accept filtering, and customizable helper text.

Loading...

Installation

pnpm dlx shadcn@latest add @basic-ui/file-dropzone

Usage

import { FileDropzone } from "@/components/basic-ui/file-dropzone"
 
export default function Example() {
  return








Previous
Label

On This Page

InstallationUsageFeaturesPropsAccessibility
file-dropzone-basic
(
<FileDropzone
accept={["image/png", "image/jpeg", "image/webp"]}
helperText="Files stay in-memory only."
onFilesSelected={(files) => {
console.log("Ready to upload", files.map((file) => file.name))
}}
/>
)
}

Features

  • Keyboard-accessible and focusable surface for uploads.
  • Accept string parsing that filters dropped files to match MIME types or extensions.
  • Helper text, icon, and CTA label slots for contextual customization.
  • Drag feedback state with accent tone option for prominent upload zones.

Props

PropTypeDefaultRequiredDescription
titlestring"Drop files here"NoTitle text rendered at the top of the dropzone
descriptionstring"Upload images in PNG, JPG, WebP, or AVIF formats (max 25 MB)."NoSupporting description below the title
helperTextstring-NoSmall helper paragraph rendered under the CTA
iconReactNodeDefault upload glyphNoOptional icon rendered inside the badge
buttonLabelstring"Browse files"NoLabel for the call-to-action button
acceptstring | string[]-NoFile types accepted by the input (image/*, .png, etc.)
multiplebooleanfalseNoAllows selecting multiple files when true
disabledbooleanfalseNoDisables pointer and keyboard interaction
tone'neutral' | 'accent''neutral'NoControls border/background emphasis
size'sm' | 'md' | 'lg''md'NoAdjusts padding and overall footprint
onFilesSelected(files: File[]) => void-NoCallback fired with filtered file list after drop or selection

Accessibility

  • The dropzone uses role="button" with keyboard triggers (Enter / Space).
  • Focus-visible outlines follow design tokens for consistency.
  • Drag-and-drop feedback is driven purely through CSS to avoid layout shifts.

Drop files here

Upload images in PNG, JPG, WebP, or AVIF formats (max 25 MB).

or drag & drop

We keep the files in-memory only. Ideal for quick image uploads.

Waiting for files…

'use client';

import { useState } from 'react';

import { FileDropzone } from '@/registry/basic-ui/file-dropzone';

export function FileDropzoneBasic() {
  const [status, setStatus] = useState('Waiting for files…');

  return (
    <div className="flex flex-col gap-(--gap-4)">
      <FileDropzone
        accept={['image/png', 'image/jpeg', 'image/webp']}
        helperText="We keep the files in-memory only. Ideal for quick image uploads."
        onFilesSelected={(files) => {
          const count = files.length;
          const suffix = count === 1 ? 'file' : 'files';
          setStatus(`Ready to process ${count} ${suffix}.`);
        }}
      />
      <p className="text-sm text-grey-text-alpha-3-hover">{status}</p>
    </div>
  );
}