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

Search Nav Bar

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

A navigation bar with an inline search field.

Navigation · SwiftUI · iOS 17

  • navigation
  • swiftui

The actual source

SearchNavBar.swift
// Search Nav Bar · syxUI · https://syxui.dev/components/nav2-search
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

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

// Nav bar with search + filter
struct SearchNavBar: View {
    var body: some View {
        HStack(spacing: 12) {
            Image(systemName: "chevron.left").font(.system(size: 17, weight: .semibold)).foregroundStyle(navBlue)
            HStack(spacing: 8) { Image(systemName: "magnifyingglass").foregroundStyle(.secondary); Text("Search").font(.system(size: 16)).foregroundStyle(.secondary); Spacer() }.padding(.horizontal, 12).padding(.vertical, 9).background(Color.primary.opacity(0.06), in: Capsule())
            Image(systemName: "line.3.horizontal.decrease").font(.system(size: 17)).foregroundStyle(navBlue)
        }.frame(width: 360)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17