Skip to content
Pinned Banner preview
Rendered from the SwiftUI source on this page.

Pinned Banner

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

A pinned-message strip anchored to the top of a thread.

Chat · SwiftUI · iOS 17

  • chat
  • swiftui

The actual source

ChatPinnedBanner.swift
// Pinned Banner · syxUI · https://syxui.dev/components/chat-pinned
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

// Pinned message banner
struct ChatPinnedBanner: View {
    let blue = Color(red: 0.0, green: 0.47, blue: 1.0)
    var body: some View {
        HStack(spacing: 10) {
            Image(systemName: "pin.fill").font(.system(size: 13)).foregroundStyle(blue).rotationEffect(.degrees(45))
            VStack(alignment: .leading, spacing: 1) {
                Text("Pinned Message").font(.system(size: 12, weight: .semibold)).foregroundStyle(blue)
                Text("Address: 123 Market St, SF").font(.system(size: 13)).foregroundStyle(.primary).lineLimit(1)
            }
            Spacer()
            Image(systemName: "chevron.right").font(.system(size: 12, weight: .semibold)).foregroundStyle(.secondary)
        }
        .padding(.horizontal, 14).padding(.vertical, 10)
        .background(Color(.systemGray6), in: RoundedRectangle(cornerRadius: 12, style: .continuous))
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17