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

# NSPanel

A special kind of window that typically performs a function that is auxiliary to the main window.

```
@MainActor class NSPanel
```

## Overview

For details about how panels work (especially to find out how their behavior differs from window behavior), see [How Panels Work](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/WinPanel/Concepts/UsingPanels.html#//apple_ref/doc/uid/20000224).

## Topics

### Configuring Panels

[`isFloatingPanel`](/documentation/AppKit/NSPanel/isFloatingPanel)

A Boolean value that indicates whether the receiver is a floating panel.

[`becomesKeyOnlyIfNeeded`](/documentation/AppKit/NSPanel/becomesKeyOnlyIfNeeded)

A Boolean value that indicates whether the receiver becomes the key window only when needed.

[`worksWhenModal`](/documentation/AppKit/NSPanel/worksWhenModal)

A Boolean value that indicates whether the panel receives keyboard and mouse events even when some other window is being run modally.

### Constants

[Alert Panel Return Values](/documentation/AppKit/alert-panel-return-values)

These constants define values returned by the [`NSRunAlertPanel`](/documentation/AppKit/NSRunAlertPanel) function and by the `NSApplication` method [`runModalSession(_:)`](/documentation/AppKit/NSApplication/runModalSession(_:)) when the modal session is run with an `NSPanel` provided by the [`NSGetAlertPanel`](/documentation/AppKit/NSGetAlertPanel) function.

[Modal Panel Return Values](/documentation/AppKit/modal-panel-return-values)

These constants define the possible return values for such methods as the `runModal...` methods of the [`NSOpenPanel`](/documentation/AppKit/NSOpenPanel) class, which tell which button (OK or Cancel) the user has clicked on an open panel.

[Style Masks](/documentation/AppKit/style-masks)

Constants that specify panel styles.



---

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)