RRenDSv0.13.0

Composite

Dropzone Requires JS

A file-drop area with drag-over feedback, click-to-browse fallback, and multi-file support. Wraps a hidden <input type="file"> so all the platform niceties — file picker, accept filtering, multiple — come along.

About

Overview

Dropzone gives users two paths to upload: drag a file in, or click and browse. Both end at the same hidden <input type="file">. The component adds visual drag-over state, file type / size validation hooks, and a built-in error display. Use it for avatars, document uploads, image galleries — anywhere "drop a file" feels right.

Live

Demo

<ren-dropzone accept="image/*" max-size="10485760">
  <input type="file" hidden>
  <div class="ren-dropzone-icon">↑</div>
  <p class="ren-dropzone-title">Drop a file or click to browse</p>
  <p class="ren-dropzone-hint">PDF, PNG, JPG up to 10 MB</p>
</ren-dropzone>

Reference

API

ClassEffect
.ren-dropzoneThe drop region. Dashed border, hover / drag-over / accepted / rejected states all via CSS.
.ren-dropzone-iconOptional leading icon (or up-arrow glyph).
.ren-dropzone-titlePrimary message — "Drop a file or click to browse".
.ren-dropzone-hintSecondary hint — accepted formats, size limit.
.ren-dropzone-listAccepted files render here once dropped / picked.

Web Component attributes

AttributeTypeDefaultNotes
acceptstring"*"MIME pattern, mirrors <input accept>. e.g. image/*, .pdf,.docx.
multiplebooleanfalseAllow multiple files per drop.
max-sizenumber (bytes)Reject files larger than this. Component shows an error message.

Events

EventDetail
ren-filesFiles were accepted. { files: File[] }.
ren-rejectFiles rejected (wrong type, too big). { files: File[], reason: string }.

Inclusive by default

Accessibility

  • The dropzone is a real <label> wrapping the hidden file input — clicking anywhere opens the file picker, no JS needed.
  • Keyboard users can Tab to the input and press Enter / Space to open the file picker.
  • Drag-over is visual only; without it, the component is still fully usable.
  • Show clear feedback on rejection — wrong type, too big — and announce it with role="alert".