---
title: "searchToolbarBehavior(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/searchtoolbarbehavior(_:)"
---

# searchToolbarBehavior(_:)

Configures the behavior for search in the toolbar.

## Declaration

```swift
nonisolated func searchToolbarBehavior(_ behavior: SearchToolbarBehavior) -> some View

```

## Discussion

Discussion This modifier can be used to change the default behavior of a search field that appears in the toolbar. Place this modifier after the searchable(text:isPresented:placement:prompt:) modifier that renders search in the toolbar. On iPhone, the search field in the bottom toolbar can be configured to appear as a button-like control when inactive: @State private var searchText = ""

NavigationStack {     RecipeList()         .searchable($searchText)         .searchToolbarBehavior(.minimized) }

## See Also

### Displaying a search interface

- [searchable(text:placement:prompt:)](swiftui/view/searchable(text:placement:prompt:).md)
- [searchable(text:isPresented:placement:prompt:)](swiftui/view/searchable(text:ispresented:placement:prompt:).md)
- [searchPresentationToolbarBehavior(_:)](swiftui/view/searchpresentationtoolbarbehavior(_:).md)
- [searchSelection(_:)](swiftui/view/searchselection(_:).md)
