media/DSFileUpload

DSFileUpload

media
since v2.0

Drag-and-drop / tap-to-browse file input with allowed type filtering, size limit, and progress overlay.

iOS 17+macOS 14+

Purpose

Document upload, attachment areas in forms, and asset import flows.

Props

PropTypeDefaultDescription
filesreqBinding<[URL]>โ€”Bound array of selected file URLs.
allowedTypes[UTType][.data]Accepted file content types.
maxFileSizeMBDouble?nilFile size limit. Shows an error if exceeded.
allowsMultipleBooltrueAllow selecting more than one file.
labelString"Drop files here or click to browse"Empty state label.

Examples

Document upload

PDF/image upload in a support ticket form.

swift
DSFileUpload(
    files: $attachments,
    allowedTypes: [.pdf, .image],
    maxFileSizeMB: 10,
    label: "Attach documents"
)

Related Components