<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/SearchFieldPlacement",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI20SearchFieldPlacementV"
  },
  "title" : "SearchFieldPlacement"
}
-->

# SearchFieldPlacement

The placement of a search field in a view hierarchy.

```
struct SearchFieldPlacement
```

## Overview

You can give a preferred placement to any of the searchable modifiers, like
[`searchable(text:placement:prompt:)`](/documentation/SwiftUI/View/searchable(text:placement:prompt:)):

```
var body: some View {
    NavigationView {
        PrimaryView()
        SecondaryView()
        Text("Select a primary and secondary item")
    }
    .searchable(text: $text, placement: .sidebar)
}
```

Depending on the containing view hierachy, SwiftUI might not be able to
fulfill your request.

## Topics

### Getting a search field placement

[`automatic`](/documentation/SwiftUI/SearchFieldPlacement/automatic)

SwiftUI places the search field automatically.

[`navigationBarDrawer`](/documentation/SwiftUI/SearchFieldPlacement/navigationBarDrawer)

The search field appears in the navigation bar.

[`navigationBarDrawer(displayMode:)`](/documentation/SwiftUI/SearchFieldPlacement/navigationBarDrawer(displayMode:))

The search field appears in the navigation bar using the specified
display mode.

[`sidebar`](/documentation/SwiftUI/SearchFieldPlacement/sidebar)

The search field appears in the sidebar of a navigation view.

[`toolbar`](/documentation/SwiftUI/SearchFieldPlacement/toolbar)

The search field appears in the toolbar.

### Supporting types

[`NavigationBarDrawerDisplayMode`](/documentation/SwiftUI/SearchFieldPlacement/NavigationBarDrawerDisplayMode)

A mode that determines when to display a search field that appears in a
navigation bar.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

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)