How to place the search bar above a List instead of in the toolbar - macOS
06:49 31 Jan 2026

In my macOS I have an inspector view with a searchable List, but the search bar always shows up in the top toolbar, detached from the list:

screenshot app

Is it possible to put the search bar inside the inspector, right above the list, just above the first row?

Note: the question is not about how to implement searching a list.

Here is a minimal code example:

import SwiftUI

struct ContentView: View {
    @State private var inspectorShown = true

    var body: some View {
        Text("Main View")
            .inspector(isPresented: $inspectorShown) {
                InspectorView()
            }
    }
}

struct InspectorView: View {
    @State private var searchText: String = ""

    var body: some View {
        List {
            Text("One")
            Text("Two")
            Text("Three")
        }
        .listStyle(.sidebar)
        .searchable(text: $searchText)
    }
}
macos swiftui searchbar