Skip to content
File Upload preview
Rendered from the SwiftUI source on this page.

File Upload

From syxUI — written for both platforms, not translated between them.

A dashed file-upload dropzone.

Inputs · SwiftUI · iOS 17

  • inputs
  • swiftui

The actual source

FileUploadField.swift
// File Upload · syxUI · https://syxui.dev/components/inp-file
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let inpBlue = Color(red: 0.0, green: 0.47, blue: 1.0)

// File upload dropzone
struct FileUploadField: View {
    var body: some View {
        VStack(spacing: 8) {
            Image(systemName: "arrow.up.doc.fill").font(.system(size: 26)).foregroundStyle(inpBlue)
            Text("Tap to upload").font(.system(size: 15, weight: .medium))
            Text("PNG, JPG or PDF (max 10MB)").font(.system(size: 12)).foregroundStyle(.secondary)
        }.frame(maxWidth: .infinity).padding(.vertical, 24).overlay(RoundedRectangle(cornerRadius: 14, style: .continuous).stroke(style: StrokeStyle(lineWidth: 1.5, dash: [6, 4])).foregroundStyle(Color.primary.opacity(0.25))).frame(width: 300)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17