Skip to content
Nav Bar preview
Rendered from the SwiftUI source on this page.

Nav Bar

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

A centered navigation bar - back button, title and a trailing action.

Navigation · SwiftUI · iOS 17

  • navigation
  • swiftui

The actual source

HeaderNavBar.swift
// Nav Bar · syxUI · https://syxui.dev/components/hdr-navbar
// 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)

// Centered nav bar with back + action
struct HeaderNavBar: View {
    var body: some View {
        HStack {
            Image(systemName: "chevron.left").font(.system(size: 18, weight: .semibold)).foregroundStyle(hdrBlue)
            Spacer()
            Text("Details").font(.system(size: 17, weight: .semibold))
            Spacer()
            Image(systemName: "square.and.arrow.up").font(.system(size: 18)).foregroundStyle(hdrBlue)
        }.frame(width: 350)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17