Component Porchlight CSS

File Upload

Drag-and-drop file upload zone. Native input hidden, CSS-only state management via :has().

52 components 51 stable 1 experimental

Command

Search Porchlight

File Upload

The .c-file-upload is a drag-and-drop zone wrapping a native <input type="file">. The input is visually hidden; the zone is the click target. Uses :has() for drag-over and disabled states.

Semantic HTML

<label class="c-file-upload">
  <input type="file" class="c-file-upload__input" multiple />
  <span class="c-file-upload__zone">
    <svg class="c-file-upload__icon">...</svg>
    <span class="c-file-upload__text">
      <strong>Drag files here</strong> or click to browse
    </span>
  </span>
</label>

Class contract

SelectorRole
.c-file-uploadLabel wrapper (click target).
.c-file-upload__inputHidden native file input.
.c-file-upload__zoneThe visible drop zone.
.c-file-upload__iconUpload icon.
.c-file-upload__textInstruction text.
[data-dragging]Drag-over state (set via JS).