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

# toolbarRole(_:)

Configures the semantic role for the content populating the toolbar.

## Declaration

```swift
nonisolated func toolbarRole(_ role: ToolbarRole) -> some View

```

## Parameters

- `role`: The role of the toolbar.

## Discussion

Discussion Use this modifier to configure the semantic role for content populating your app’s toolbar. SwiftUI uses this role when rendering the content of your app’s toolbar. ContentView()     .navigationTitle("Browser")     .toolbarRole(.browser)     .toolbar {         ToolbarItem(placement: .primaryAction) {             AddButton()         }      }

## See Also

### Specifying the role of toolbar content

- [ToolbarRole](swiftui/toolbarrole.md)
