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

# NSPathCell

The user interface of a path control object.

```
class NSPathCell
```

## Overview

[`NSPathCell`](/documentation/AppKit/NSPathCell) maintains a collection of [`NSPathComponentCell`](/documentation/AppKit/NSPathComponentCell) objects that represent a particular path to be displayed to the user.

The path shown can be set with the [`clickedPathComponentCell`](/documentation/AppKit/NSPathCell/clickedPathComponentCell) method. Doing so removes all displayed `NSPathComponentCell` objects and automatically fills the control with `NSPathComponentCell` objects set to have the appropriate icons, display titles, and `NSURL` values for the particular path component they represent. Alternatively, you can fill the control manually by setting the cell array or directly modifying existing cells.

Both an action and double-click action can be set for the path control. To find out what path component cell was clicked in the action, you can read the value of [`clickedPathComponentCell`](/documentation/AppKit/NSPathCell/clickedPathComponentCell). When the style is set to [`NSPathControl.Style.popUp`](/documentation/AppKit/NSPathControl/Style/popUp), the action is still sent, and the [`clickedPathComponentCell`](/documentation/AppKit/NSPathCell/clickedPathComponentCell) value for the represented menu item is correctly set. The [`clickedPathComponentCell`](/documentation/AppKit/NSPathCell/clickedPathComponentCell) value is valid only when the action is being sent. It is also valid when the keyboard is used to invoke the action.

Automatic animated expansion of partially hidden `NSPathComponentCell` objects happens if you correctly call [`mouseEntered(with:)`](/documentation/AppKit/NSResponder/mouseEntered(with:)) and [`mouseExited(with:)`](/documentation/AppKit/NSResponder/mouseExited(with:)) for each `NSPathComponentCell` in the `NSPathCell` object. This is not required if the [`pathStyle`](/documentation/AppKit/NSPathCell/pathStyle) is set to [`NSPathControl.Style.popUp`](/documentation/AppKit/NSPathControl/Style/popUp), or if you wish to not have the animation.

`NSPathCell` supports several path display styles. [`NSPathControl.Style.standard`](/documentation/AppKit/NSPathControl/Style/standard) has a light blue background with arrows indicating the path. [`NSPathStyleNavigationBar`](/documentation/AppKit/NSPathStyle/NSPathStyleNavigationBar) has more defined arrows (chevrons) and looks a little like a segmented button. [`NSPathControl.Style.popUp`](/documentation/AppKit/NSPathControl/Style/popUp) looks and works like an [`NSPopUpButton`](/documentation/AppKit/NSPopUpButton) object to display the full path, or, if the cell is editable, select a new path.

If the cell’s [`isEditable`](/documentation/AppKit/NSCell/isEditable) method returns <doc://com.apple.documentation/documentation/Swift/true> (the default), you can drag and drop into the cell to change the value. You can constrain what can be dropped using UTIs (Uniform Type Identifiers) with [`allowedTypes`](/documentation/AppKit/NSPathCell/allowedTypes) or the appropriate delegate methods on `NSPathControl`.

If the cell’s [`isSelectable`](/documentation/AppKit/NSCell/isSelectable) method returns <doc://com.apple.documentation/documentation/Swift/true> (the default), the cell’s contents can automatically be dragged out. The proper UTI, filename, and URL are placed on the pasteboard. You can further control or limit this by using the appropriate delegate methods on `NSPathControl`.

If the cell is editable and has the path style set to [`NSPathControl.Style.popUp`](/documentation/AppKit/NSPathControl/Style/popUp), an additional item in the pop-up menu allows selecting another location. By default, an `NSOpenPanel` object is configured based on the allowed types. The `NSOpenPanel` object can be customized with a delegate method.

## Setting the control size

When setting the [`controlSize`](/documentation/AppKit/NSCell/controlSize) property, `NSPathCell` properly respects the control size for the [`NSPathControl.Style.standard`](/documentation/AppKit/NSPathControl/Style/standard) and [`NSPathControl.Style.popUp`](/documentation/AppKit/NSPathControl/Style/popUp) styles. When the control size is set, the new size is propagated to subcells. When the path style is set to [`NSPathStyleNavigationBar`](/documentation/AppKit/NSPathStyle/NSPathStyleNavigationBar), you cannot change the control size, and it is always set to [`NSSmallControlSize`](/documentation/AppKit/NSSmallControlSize). Attempting to change the control size when the path style is [`NSPathStyleNavigationBar`](/documentation/AppKit/NSPathStyle/NSPathStyleNavigationBar) causes an assertion. Setting the path style to [`NSPathStyleNavigationBar`](/documentation/AppKit/NSPathStyle/NSPathStyleNavigationBar) forces the control size to be [`NSSmallControlSize`](/documentation/AppKit/NSSmallControlSize).

## Topics

### Displaying Hidden Components

[`-  mouseEntered:withFrame:inView:`](/documentation/AppKit/NSPathCell/mouseEntered(with:frame:in:))

Displays the cell component over which the mouse is hovering.

[`-  mouseExited:withFrame:inView:`](/documentation/AppKit/NSPathCell/mouseExited(with:frame:in:))

Hides the cell component over which the mouse is hovering.

### Setting the Allowed Types

[`allowedTypes`](/documentation/AppKit/NSPathCell/allowedTypes)

Sets the component types allowed in the path when the cell is editable.

### Setting the Control Style

[`pathStyle`](/documentation/AppKit/NSPathCell/pathStyle)

Sets the receiver’s path style.

### Setting the Object Value

[`-  setObjectValue:`](/documentation/AppKit/NSPathCell/setObjectValue(_:))

Sets the receiver’s object value.

### Setting Cell Appearance

[`placeholderAttributedString`](/documentation/AppKit/NSPathCell/placeholderAttributedString)

Sets the value of the placeholder attributed string.

[`placeholderString`](/documentation/AppKit/NSPathCell/placeholderString)

Returns the placeholder string.

[`backgroundColor`](/documentation/AppKit/NSPathCell/backgroundColor)

Returns the current background color of the receiver.

### Managing Path Components

[`pathComponentCellClass`](/documentation/AppKit/NSPathCell/pathComponentCellClass)

Returns the class used to create `pathComponentCell` objects when automatically filling up the control.

[`-  rectOfPathComponentCell:withFrame:inView:`](/documentation/AppKit/NSPathCell/rect(of:withFrame:in:))

Returns the current rectangle being displayed for a given path component cell, with respect to a given frame in a given view.

[`-  pathComponentCellAtPoint:withFrame:inView:`](/documentation/AppKit/NSPathCell/pathComponentCell(at:withFrame:in:))

Returns the cell located at the given point within the given frame of the given view.

[`clickedPathComponentCell`](/documentation/AppKit/NSPathCell/clickedPathComponentCell)

Sets the value of the path displayed by the receiver.

[`pathComponentCells`](/documentation/AppKit/NSPathCell/pathComponentCells)

Sets the array of `NSPathComponentCell` objects currently being displayed.

### Setting the Double-Click Action

[`doubleAction`](/documentation/AppKit/NSPathCell/doubleAction)

Sets the receiver’s double-click action.

### Setting the Path

[`URL`](/documentation/AppKit/NSPathCell/url)

Returns the path displayed by the receiver.

[`clickedPathComponentCell`](/documentation/AppKit/NSPathCell/clickedPathComponentCell)

Sets the value of the path displayed by the receiver.

### Setting the Delegate

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

Sets the receiver’s delegate.

### Constants

[`Style`](/documentation/AppKit/NSPathControl/Style)

`NSPathStyle` constants represent the different visual and behavioral styles an `NSPathControl` or `NSPathCell` object can have.

## Relationships

### Conforms To

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

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

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

[`Equatable`](/documentation/Swift/Equatable)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

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

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

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

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

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

### Inherits From

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

---

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)