SweetUI

Search items

Jump to an item

component

attachment

Row: square media, name, detail, caller actions. States: idle, uploading, processing, failed, completed.

attachmentfileuploadrowmediashadcn
attachment, light

On iPad

The same installed source at a regular width. It adapts its layout without a separate design.

attachment on iPad, light

Install

With the sweetui tool (brew install mangobyte-dev/tap/sweetui):

sweetui install attachment --destination Sources/YourFeature/Components

Installs in order: avatar 0.2.1, separator 0.2.1, badge 0.3.2, item 0.2.2, progress 0.2.1, button 0.5.2, attachment 0.1.2. Point --destination at a folder inside the consuming target's sources.

Usage

AttachmentRow(
    name: Text("Statement-Aug-2026.pdf"),
    detail: Text("PDF document, 1.2 MB"),
    state: .uploading(progress: 0.68)
) {
    Image(systemName: "doc.fill")
} actions: {
    Button("Cancel", systemImage: "xmark") {}
        .labelStyle(.iconOnly)
        .buttonStyle(.registryGhost)
        .accessibilityLabel("Cancel upload")
}

// A completed attachment with a thumbnail and no actions: the bare trailing closure is the thumbnail.
AttachmentRow(
    name: Text("Receipt.jpg"),
    detail: Text("Image, 240 KB"),
    state: .completed
) {
    Image(systemName: "photo")
}

Accessibility contract

  • State text: percent, Processing, failure, Uploaded; MUST NOT rely on color/bar.
  • VoiceOver skips percent; bar reports it.
  • ItemRow: name+detail one element; actions separate, activatable.
  • Failed/completed: color, symbol, word; not hue-only.
  • Icon buttons, thumbnail MUST label, not text-derived.

Details

Kindcomponent
Version0.1.2
PlatformsiOS 26.0+
Dependenciesitem, progress, button, separator
SourceRegistry/sources/components/AttachmentRow.swift
Xcode previewAttachment Row