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

Article Card

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

A blog / article card with a cover image, category tag and author.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

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

import SwiftUI

// Article card - image, category, author
struct ArticleCard: View {
    var body: some View {
        VStack(alignment: .leading, spacing: 0) {
            Image("photo_travel").resizable().scaledToFill().frame(width: 300, height: 160).clipped()
            VStack(alignment: .leading, spacing: 8) {
                Text("TRAVEL").font(.system(size: 11, weight: .bold)).foregroundStyle(Color(red: 0.0, green: 0.47, blue: 1.0)).tracking(0.5)
                Text("A Weekend Guide to the Greek Islands").font(.system(size: 17, weight: .semibold)).lineLimit(2)
                HStack(spacing: 8) {
                    Image("person_3").resizable().scaledToFill().frame(width: 24, height: 24).clipShape(Circle())
                    Text("Mia Chen").font(.system(size: 13, weight: .medium))
                    Text("· 5 min read").font(.system(size: 13)).foregroundStyle(.secondary)
                }
            }.padding(14)
        }
        .frame(width: 300)
        .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 · 2 dependencies

Dependencies

SwiftUI
  • person_3 (image asset)
  • photo_travel (image asset)

Requires iOS 17