Dropzone
A file-upload area — drag and drop or click to browse over a hidden <input type="file">, with a dragover highlight, a removable list of chosen files, and accept plus maxSize validation. Controlled and value-first: the parent owns the files array; picks and drops come back through @change.
- brand-guidelines.pdf2.3 MB
Installation
Copy the piece into your app — it compiles with your build and the code is yours:
puzzle add piece dropzone
Pulls in the chat-attachment piece (each chosen file renders as a ChatAttachment chip) and the pieces.css tokens.
Usage
import Dropzone from '@/components/ui/Dropzone.pzl';
<Dropzone label="Attachment" files={ files } accept=".pdf,.doc,.docx" @change={ setFiles } />Multiple files
- hero-banner.png825 KB
- promo-loop.mp418 MB
PNG, JPG or GIF
Accept and max size
- profile.png129 KB
PNG or JPG, up to 1 MB
Error state
A resume is required
Disabled
Accessibility
The real <input type="file"> stays visually hidden but reachable, so keyboard and assistive-tech users tab to it (it carries the label, aria-describedby, and aria-invalid) and open the native picker with Space or Enter; pointer users click anywhere on the zone.
The focus ring is painted on the zone with focus-within, its color set unconditionally (danger when errored) so transition-colors never flashes it. Validation messages live in an aria-live="polite" region. An external error takes priority over internal accept/maxSize messages.