Choose files or drag them here
Up to 5.0 MB each
Installation
$ pnpm dlx shadcn@latest add @synccn/dropzoneFirst 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.
PropTypeDescription
- accept
stringFile types, as for an input's accept attribute.
- multiple
booleanDefault
trueAllow several files.
- maxSize
numberDefault
10 * 1048576Largest file allowed, in bytes.
- onFilesChange
(files: DropzoneFile[]) => voidCalled whenever the list changes.
- className
stringExtra 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
- lib/utilscn (merges class names)
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for FileText, ImageIcon, UploadCloud, X
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
More inputs
ButtonSeven variants, four sizes and a built-in loading state.InputText field with optional leading icon and invalid state.TextareaMulti-line field that grows with its content and counts characters.CheckboxChecked, unchecked and indeterminate, with label and description.SwitchToggle with a springy thumb in three sizes.Radio GroupPick one option, shown as dots or as selectable cards.