Skip to content
Listing Card preview
Rendered from the SwiftUI source on this page.

Listing Card

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

A property listing - photo, price and bed / bath / area.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

ListingCard.swift
// Listing Card · syxUI · https://syxui.dev/components/card-listing
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

// Property listing card
struct ListingCard: View {
    var body: some View {
        VStack(alignment: .leading, spacing: 0) {
            Image("photo_travel").resizable().scaledToFill().frame(width: 280, height: 170).clipped()
                .overlay(alignment: .topLeading) {
                    Text("For Sale").font(.system(size: 11, weight: .bold)).foregroundStyle(.white).padding(.horizontal, 8).padding(.vertical, 4).background(Color(red: 0.16, green: 0.66, blue: 0.40), in: Capsule()).padding(10)
                }
            VStack(alignment: .leading, spacing: 6) {
                Text("$1,250,000").font(.system(size: 19, weight: .bold))
                Text("Oceanview Villa, Santorini").font(.system(size: 14)).foregroundStyle(.secondary)
                HStack(spacing: 16) {
                    Label("4 bd", systemImage: "bed.double").font(.system(size: 13)).foregroundStyle(.secondary)
                    Label("3 ba", systemImage: "shower").font(.system(size: 13)).foregroundStyle(.secondary)
                    Label("2,400 ft²", systemImage: "square.dashed").font(.system(size: 13)).foregroundStyle(.secondary)
                }
            }.padding(14)
        }
        .frame(width: 280)
        .background(Color(.systemBackground)).clipShape(RoundedRectangle(cornerRadius: 20, style: .continuous))
        .overlay(RoundedRectangle(cornerRadius: 20, style: .continuous).stroke(Color.primary.opacity(0.06), lineWidth: 1))
        .shadow(color: .black.opacity(0.06), radius: 12, y: 5)
    }
}
iOS 17 · 1 dependencies

Dependencies

SwiftUI
  • photo_travel (image asset)

Requires iOS 17