Skip to content
Notifications Header preview
Rendered from the SwiftUI source on this page.

Notifications Header

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

A notifications title with a count badge and 'Mark all read'.

Navigation · SwiftUI · iOS 17

  • navigation
  • swiftui

The actual source

HeaderNotifications.swift
// Notifications Header · syxUI · https://syxui.dev/components/hdr-notifications
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let hdrBlue = Color(red: 0.0, green: 0.47, blue: 1.0)

// Notifications header - title + mark all read
struct HeaderNotifications: View {
    var body: some View {
        HStack(alignment: .firstTextBaseline) {
            HStack(spacing: 8) {
                Text("Notifications").font(.system(size: 24, weight: .bold))
                Text("4").font(.system(size: 12, weight: .bold)).foregroundStyle(.white).frame(width: 22, height: 22).background(.red, in: Circle())
            }
            Spacer()
            Text("Mark all read").font(.system(size: 13, weight: .medium)).foregroundStyle(hdrBlue)
        }.frame(width: 350)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17