One Logo Pool Ball
SwiftUI · IOS API REFERENCE

ToolbarRole

struct · iOS 16.0+ · SDK 27.1

struct ToolbarRole

The purpose of content that populates the toolbar. 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 ``ToolbarRole/browser`` will automatically leading align the title of a toolbar in iPadOS. Provide this type to the ``View/toolbarRole(_:)`` modifier: ContentView() .navigationTitle("Browser") .toolbarRole(.browser) .toolbar { ToolbarItem(placement: .primaryAction) { AddButton() } }

Members (4)

get · iOS 16.0+

navigationStack

TypeScript
static get navigationStack(): ToolbarRole
Swift declaration
static var navigationStack: ToolbarRole { get }

The navigationStack role. Use this role for content that can be pushed and popped.

get · iOS 16.0+

editor

TypeScript
static get editor(): ToolbarRole
Swift declaration
static var editor: ToolbarRole { get }

The editor role. Use this role for a toolbar that primarily displays controls geared towards editing document-like content. In iPadOS, this will leading align the navigation title, allow for toolbar items to occupy the center of the navigation bar, and provide a custom appearance for any back button present in the toolbar.

get · iOS 16.0+

browser

TypeScript
static get browser(): ToolbarRole
Swift declaration
static var browser: ToolbarRole { get }

The browser role. Use this role for content that can be navigated forwards and backwards. In iPadOS, this will leading align the navigation title and allow for toolbar items to occupy the center of the navigation bar.

get · iOS 16.0+

automatic

TypeScript
static get automatic(): ToolbarRole
Swift declaration
static var automatic: ToolbarRole { get }

The automatic role. In iOS, tvOS, and watchOS this resolves to the ``ToolbarRole/navigationStack`` role. In macOS, this resolves to the ``ToolbarRole/editor`` role.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUI types →