<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSToolbar",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSToolbar"
  },
  "title" : "NSToolbar"
}
-->

# NSToolbar

An object that manages the space above your app’s custom content and either below or integrated with the window’s title bar.

```
@MainActor class NSToolbar
```

## Overview

An [`NSToolbar`](/documentation/AppKit/NSToolbar) object manages the controls and views that apply to the main window’s content area. Toolbars provide convenient access to the commands and features people use most often. Toolbars are also user-configurable and support the display of an interactive customization palette.

Create and configure your toolbar programmatically or using Interface Builder. Add items to the toolbar that correspond to the commands you want to feature in your window. Each item has a corresponding [`NSToolbarItem`](/documentation/AppKit/NSToolbarItem) object, which you use to make changes. Each toolbar manages a unique set of items, but you can synchronize the items and state of multiple toolbars by assigning the same value to their [`identifier`](/documentation/AppKit/NSToolbar/identifier-swift.property) properties.

For more information about how to use toolbars, see [Integrating a Toolbar and Touch Bar into Your App](/documentation/AppKit/integrating-a-toolbar-and-touch-bar-into-your-app).

## Topics

### Creating an toolbar object

[`init(identifier:)`](/documentation/AppKit/NSToolbar/init(identifier:))

Creates a newly allocated toolbar with the specified identifier.

[`init()`](/documentation/AppKit/NSToolbar/init())

Creates a new toolbar with an empty identifier string.

### Configuring the toolbar contents

[`delegate`](/documentation/AppKit/NSToolbar/delegate)

The object you use to customize the toolbar contents and configuration.

[`NSToolbarDelegate`](/documentation/AppKit/NSToolbarDelegate)

A set of optional methods you use to configure the toolbar and respond to changes.

### Getting the toolbar’s identity

[`identifier`](/documentation/AppKit/NSToolbar/identifier-swift.property)

The value you use to identify the toolbar in your app.

[`NSToolbar.Identifier`](/documentation/AppKit/NSToolbar/Identifier-swift.typealias)

A string value that you use to differentiate your app’s toolbars.

### Configuring the toolbar’s behavior

[`isVisible`](/documentation/AppKit/NSToolbar/isVisible)

A Boolean value that indicates whether the toolbar is visible.

[`displayMode`](/documentation/AppKit/NSToolbar/displayMode-swift.property)

A value that indicates whether the toolbar displays items using a name, icon, or combination of elements.

[`NSToolbar.DisplayMode`](/documentation/AppKit/NSToolbar/DisplayMode-swift.enum)

Constants that indicate whether the toolbar displays items using a name, icon, or combination of elements.

[`showsBaselineSeparator`](/documentation/AppKit/NSToolbar/showsBaselineSeparator)

A Boolean value that indicates whether the toolbar shows the separator between the toolbar and the main window contents.

[`allowsUserCustomization`](/documentation/AppKit/NSToolbar/allowsUserCustomization)

A Boolean value that indicates whether users can modify the contents of the toolbar.

[`allowsExtensionItems`](/documentation/AppKit/NSToolbar/allowsExtensionItems)

A Boolean value that indicates whether the toolbar can add items for Action extensions.

### Managing items on the toolbar

[`items`](/documentation/AppKit/NSToolbar/items)

An array containing the toolbar’s current items, in order.

[`visibleItems`](/documentation/AppKit/NSToolbar/visibleItems)

An array containing the toolbar’s currently visible items.

[`centeredItemIdentifiers`](/documentation/AppKit/NSToolbar/centeredItemIdentifiers)

The set of custom items to display in the center of the toolbar.

[`selectedItemIdentifier`](/documentation/AppKit/NSToolbar/selectedItemIdentifier)

The identifier of the toolbar’s currently selected item.

[`willAddItemNotification`](/documentation/AppKit/NSToolbar/willAddItemNotification)

Posts before the toolbar adds a new item.

[`didRemoveItemNotification`](/documentation/AppKit/NSToolbar/didRemoveItemNotification)

Posted after an item is removed from a toolbar.

[`insertItem(withItemIdentifier:at:)`](/documentation/AppKit/NSToolbar/insertItem(withItemIdentifier:at:))

Inserts an item into the toolbar at the specified index.

[`removeItem(at:)`](/documentation/AppKit/NSToolbar/removeItem(at:))

Removes the item at the specified index in the toolbar.

### Autosaving the configuration

[`autosavesConfiguration`](/documentation/AppKit/NSToolbar/autosavesConfiguration)

A Boolean value that indicates whether the toolbar autosaves its configuration.

[`configuration`](/documentation/AppKit/NSToolbar/configuration)

A dictionary containing the current configuration details for the toolbar.

[`setConfiguration(_:)`](/documentation/AppKit/NSToolbar/setConfiguration(_:))

Specifies the new configuration details for the toolbar.

### Displaying the customization palette

[`runCustomizationPalette(_:)`](/documentation/AppKit/NSToolbar/runCustomizationPalette(_:))

Displays the toolbar’s customization palette and handles any user-initiated customizations.

[`customizationPaletteIsRunning`](/documentation/AppKit/NSToolbar/customizationPaletteIsRunning)

A Boolean value that indicates whether the toolbar’s customization palette is in use.

### Validating visible items

[`validateVisibleItems()`](/documentation/AppKit/NSToolbar/validateVisibleItems())

Validates the toolbar’s visible items during a window update.

### Deprecated

[`centeredItemIdentifier`](/documentation/AppKit/NSToolbar/centeredItemIdentifier)

The item to display in the center of the toolbar.

[`fullScreenAccessoryView`](/documentation/AppKit/NSToolbar/fullScreenAccessoryView)

The toolbar’s full screen accessory view.

[`fullScreenAccessoryViewMinHeight`](/documentation/AppKit/NSToolbar/fullScreenAccessoryViewMinHeight)

The minimum height of the toolbar’s full screen accessory view.

[`fullScreenAccessoryViewMaxHeight`](/documentation/AppKit/NSToolbar/fullScreenAccessoryViewMaxHeight)

The maximum height of the toolbar’s full screen accessory view, in points.

[`sizeMode`](/documentation/AppKit/NSToolbar/sizeMode-swift.property)

The toolbar’s size mode.

[`NSToolbar.SizeMode`](/documentation/AppKit/NSToolbar/SizeMode-swift.enum)

Constants that specify toolbar display modes.



---

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)