---
title: Using contextual menu and toolbar item keys
framework: safariservices
role: article
role_heading: Article
path: safariservices/using-contextual-menu-and-toolbar-item-keys
---

# Using contextual menu and toolbar item keys

Learn about adding contextual menu items and toolbar items to a Safari app extension with information property list keys.

## Overview

Overview Contextual menu items and toolbar items give you ways to add more menu options and entry points to your Safari app extension. You define and adjust these items using information property list keys. Add context menu items The SFSafariContextMenu key lets your app extension add items to the context menu that appears in webpages. See Context menus for design guidelines.

The key’s value must be an array, and must contain one dictionary with two subkeys for each menu item.  |  |   |  |   |  |  For example, if you add two contextual menu items, your Info.plist file might look like the following: <key>SFSafariContextMenu</key> <array> 	<dict> 		<key>Text</key> 		<string>Search for selected text in MyApplication.</string> 		<key>Command</key> 		<string>Search</string> 	</dict> 	<dict> 		<key>Text</key> 		<string>Add an entry for selected text in MyApplication.</string> 		<key>Command</key> 		<string>Add</string> 	</dict> </array> Add a toolbar item The SFSafariToolbarItem dictionary adds a toolbar item to Safari windows. See Toolbars for design guidelines.

Each app extension can have only one toolbar item. The value for this key is a dictionary that describes the toolbar item. There are four required keys for the toolbar item dictionary.  |  |   |  |   |  |   |  |   |  |  Here’s an example dictionary in XML: <dict> 	<key>Action</key> 	<string>Command</string> 	<key>Identifier</key> 	<string>Button</string> 	<key>Image</key> 	<string>Toolbar.pdf</string> 	<key>Label</key> 	<string>My Item</string> </dict> Use the Image key to provide an image for the toolbar button. Safari may resize or recolor the toolbar button image when drawing it to the screen. Make your image a template image and follow the guidelines for toolbar items. note: Buttons on the Safari toolbar are largely transparent, allowing them to fill with the appropriate gradient for the current macOS user interface. You don’t need to draw the button itself.

## See Also

### Contextual menu and toolbar items

- [Adjusting settings for a toolbar item](safariservices/adjusting-settings-for-a-toolbar-item.md)
- [Adjusting settings for contextual menu items](safariservices/adjusting-settings-for-contextual-menu-items.md)
- [SFSafariToolbarItem](safariservices/sfsafaritoolbaritem.md)
- [SFSafariExtensionViewController](safariservices/sfsafariextensionviewcontroller.md)
