Skip to content
Grouped Form preview
Rendered from the SwiftUI source on this page.

Grouped Form

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

A grouped form input — self-contained SwiftUI, styled from system tokens.

Inputs · SwiftUI · iOS 17

  • inputs
  • swiftui

The actual source

GroupedFormCard.swift
// Grouped Form · syxUI · https://syxui.dev/components/input-grouped
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

extension View {
    func formaCard(_ pad: CGFloat = 18) -> some View {
        self.padding(pad)
            .background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: 20, style: .continuous))
            .overlay(RoundedRectangle(cornerRadius: 20, style: .continuous).stroke(Color.primary.opacity(0.06), lineWidth: 1))
            .shadow(color: .black.opacity(0.05), radius: 14, x: 0, y: 6)
    }
}

// 20. Grouped inset form
struct GroupedFormCard: View {
    var body: some View {
        VStack(spacing: 0) {
            row("Name", "John Appleseed")
            Divider().padding(.leading, 16)
            row("Email", "john@mobbin.com")
            Divider().padding(.leading, 16)
            row("Password", "••••••••", secure: true)
        }
        .background(Color.primary.opacity(0.04), in: RoundedRectangle(cornerRadius: 16))
        .formaCard(0)
    }
    @ViewBuilder func row(_ label: String, _ value: String, secure: Bool = false) -> some View {
        HStack {
            Text(label).font(.system(size: 16, weight: .medium)).frame(width: 92, alignment: .leading)
            Text(value).font(.system(size: 16)).foregroundStyle(secure ? .primary : .secondary)
            Spacer()
        }
        .padding(.horizontal, 16).padding(.vertical, 15)
    }
}
iOS 17 · 1 dependencies

Dependencies

SwiftUI
  • formaCard

Requires iOS 17