<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ToolbarRole",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI11ToolbarRoleV"
  },
  "title" : "ToolbarRole"
}
-->

# ToolbarRole

The purpose of content that populates the toolbar.

```
struct ToolbarRole
```

## Overview

A toolbar role provides a description of the purpose of content that
populates the toolbar. The purpose of the content influences how a toolbar
renders its content. For example, a [`browser`](/documentation/SwiftUI/ToolbarRole/browser) will
automatically leading align the title of a toolbar in iPadOS.

Provide this type to the [`toolbarRole(_:)`](/documentation/SwiftUI/View/toolbarRole(_:)) modifier:

```
ContentView()
    .navigationTitle("Browser")
    .toolbarRole(.browser)
    .toolbar {
        ToolbarItem(placement: .primaryAction) {
            AddButton()
        }
     }
```

## Topics

### Behavior-specific roles

[`browser`](/documentation/SwiftUI/ToolbarRole/browser)

The browser role.

[`editor`](/documentation/SwiftUI/ToolbarRole/editor)

The editor role.

[`navigationStack`](/documentation/SwiftUI/ToolbarRole/navigationStack)

The navigationStack role.

### Automatic roles

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

The automatic role.



---

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)