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

Recipe Card

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

A recipe card with a photo, cook time and difficulty.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

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

import SwiftUI

// Recipe card
struct RecipeCard: View {
    var body: some View {
        VStack(alignment: .leading, spacing: 0) {
            Image("photo_food").resizable().scaledToFill().frame(width: 260, height: 160).clipped()
                .overlay(alignment: .topTrailing) {
                    Image(systemName: "bookmark.fill").font(.system(size: 13)).foregroundStyle(.white).padding(8).background(.black.opacity(0.3), in: Circle()).padding(10)
                }
            VStack(alignment: .leading, spacing: 6) {
                Text("Avocado Toast & Eggs").font(.system(size: 16, weight: .semibold))
                HStack(spacing: 14) {
                    Label("15 min", systemImage: "clock").font(.system(size: 13)).foregroundStyle(.secondary)
                    Label("Easy", systemImage: "flame").font(.system(size: 13)).foregroundStyle(.secondary)
                }
            }.padding(14)
        }
        .frame(width: 260)
        .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_food (image asset)

Requires iOS 17