Contents

NSToolbarItem

A single item that appears in a window’s toolbar.

Declaration

@MainActor class NSToolbarItem

Overview

An NSToolbarItem object displays an image and text string in the toolbar area of a window. You can also create toolbar items that display custom views you provide. Toolbar items provide fast access to common commands or features in the window. For example, the Finder window uses toolbar items to help someone navigate the file system.

You typically create toolbar items at the same time you create your window’s toolbar. The system provides some standard items like spacers you can include in your toolbar. It also provides items that display standard interfaces like the color panel or font panel. For any custom toolbar items you create, provide an action method to call when someone clicks the item.

You can display your toolbar item’s content using a custom view if you prefer, rather than an image and text label. If you specify an NSSearchField object for the view, the system automatically adjusts the minimum and maximum size of the search field to the system-standard values.

Topics

Creating a toolbar item

Getting the toolbar item’s identity

Describing the item

Getting the item’s visual appearance

Performing the item’s action

Configuring the item’s menu

Getting the item’s configuration

Getting the parent toolbar

Validating the item

Deprecated

See Also

Items