Skip to content
synccn

Dropzone

Drag-and-drop uploads with previews, size checks and progress.

Choose files or drag them here

Up to 5.0 MB each

Installation

$ pnpm dlx shadcn@latest add @synccn/dropzone

First time in this project? Connect synccn with one command.

Usage

import { Dropzone } from "@/components/ui/dropzone";<Dropzone maxSize={5 * 1048576} />

API reference

Generated from the component's TypeScript types, so it always matches the code.

Dropzone

Drag-and-drop file picker with previews and simulated upload progress. Swap `simulate` for your own upload function.

  • accept
    string

    File types, as for an input's accept attribute.

  • multiple
    boolean

    Default true

    Allow several files.

  • maxSize
    number

    Default 10 * 1048576

    Largest file allowed, in bytes.

  • onFilesChange
    (files: DropzoneFile[]) => void

    Called whenever the list changes.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

npm packages

Keyboard

  • EnterorSpaceOpen the file picker

Accessibility

  • The drop area is a button, so it works without dragging.

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA roles: button
  • ARIA attributes: aria-label
  • Keys handled: Enter, Space
  • Shows a visible focus ring for keyboard users
  • Includes text only screen readers hear