<!--
{
  "availability" : [
    "macOS: 13.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ToolbarPlacement/accessoryBar(id:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI16ToolbarPlacementV12accessoryBar2idACx_tSHRzlFZ"
  },
  "title" : "accessoryBar(id:)"
}
-->

# accessoryBar(id:)

Creates a unique accessory bar placement.

```
@backDeployed(before: macOS 14.0)
static func accessoryBar<ID>(id: ID) -> ToolbarPlacement where ID : Hashable
```

## Parameters

`id`

A unique identifier for this placement.

## Discussion

On macOS, accessory bars are in a section below the title bar and
toolbar area of the window. Each separate identifier will correspond to
a separate accessory bar that is added to this area.

Use a custom placement to control the appearance of the containing bar
for items using a custom [`ToolbarItemPlacement`](/documentation/SwiftUI/ToolbarItemPlacement) with the same
identifier.

```
private let favoritesBarID = "com.example.favoritesBar"
extension ToolbarItemPlacement {
    static let favoritesBar = accessoryBar(id: favoritesBarID)
}
extension ToolbarPlacement {
    static let favoritesBar = accessoryBar(id: favoritesBarID)
}
...
BrowserView()
    .toolbar {
        ToolbarItem(placement: .favoritesBar) {
            FavoritesBar()
        }
    }
    .toolbar(.hidden, for: .favoritesBar)
```

---

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)