Skip to content
Add Menu preview
Rendered from the SwiftUI source on this page.

Add Menu

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

An add-attachment grid sheet.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

AddMenuSheet.swift
// Add Menu · syxUI · https://syxui.dev/components/sheet-add
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let shBlue = Color(red: 0.0, green: 0.47, blue: 1.0)
let shRed = Color(red: 0.90, green: 0.24, blue: 0.28)
let shGreen = Color(red: 0.16, green: 0.66, blue: 0.40)

func shCard<C: View>(_ w: CGFloat, radius: CGFloat = 18, @ViewBuilder _ c: () -> C) -> some View {
    c().frame(width: w).background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: radius, style: .continuous)).overlay(RoundedRectangle(cornerRadius: radius, style: .continuous).stroke(Color.primary.opacity(0.07), lineWidth: 1)).shadow(color: .black.opacity(0.05), radius: 12, y: 5)
}

// Add options grid sheet
struct AddMenuSheet: View {
    let opts: [(String, Color, String)] = [("photo", shBlue, "Photo"), ("doc.fill", shGreen, "Document"), ("location.fill", shRed, "Location"), ("person.fill", Color(red: 0.55, green: 0.40, blue: 0.90), "Contact")]
    var body: some View {
        shCard(330, radius: 22) {
            VStack(spacing: 14) {
                Capsule().fill(Color.primary.opacity(0.2)).frame(width: 36, height: 5)
                Text("Add to Message").font(.system(size: 17, weight: .semibold))
                HStack(spacing: 14) { ForEach(Array(opts.enumerated()), id: \.offset) { _, o in VStack(spacing: 6) { Image(systemName: o.0).font(.system(size: 22)).foregroundStyle(.white).frame(width: 56, height: 56).background(o.1, in: RoundedRectangle(cornerRadius: 16, style: .continuous)); Text(o.2).font(.system(size: 11)).foregroundStyle(.secondary) } } }
            }.padding(.horizontal, 18).padding(.top, 12).padding(.bottom, 18)
        }
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17