<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/tabViewSearchActivation(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE03tabC16SearchActivationyQrAA03TabeF0VF"
  },
  "title" : "tabViewSearchActivation(_:)"
}
-->

# tabViewSearchActivation(_:)

Configures the activation and deactivation behavior of search in the
search tab.

```
nonisolated func tabViewSearchActivation(_ activation: TabSearchActivation) -> some View
```

## Discussion

Use this modifier on a [`TabView`](/documentation/SwiftUI/TabView) to change how search activation is
handled. The exact activation behavior is determined by the
[`TabSearchActivation`](/documentation/SwiftUI/TabSearchActivation) you pass to this modifier:

```
struct TabExampleView: View {
    @State private var text: String = ""

    var body: some View {
        TabView {
            Tab("Books", systemImage: "book") {
                BooksTab()
            }
            Tab(role: .search) {
                NavigationStack {
                    SearchContent()
                }
            }
        }
        .searchable(text: $text)
        .tabViewSearchActivation(.searchTabSelection)
    }
}
```

By default, search is only activated and deactivated by the user.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)