<!--
{
  "documentType" : "article",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/modal-windows-and-panels",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Modal Windows and Panels"
}
-->

# Modal Windows and Panels

Display a modal window or show one of the standard app panels, such as the app’s About panel.

## Topics

### Running a Modal Window

[`runModal(for:)`](/documentation/AppKit/NSApplication/runModal(for:))

Starts a modal event loop for the specified window.

[`stopModal()`](/documentation/AppKit/NSApplication/stopModal())

Stops a modal event loop.

[`stopModal(withCode:)`](/documentation/AppKit/NSApplication/stopModal(withCode:))

Stops a modal event loop, allowing you to return a custom result code.

[`abortModal()`](/documentation/AppKit/NSApplication/abortModal())

Aborts the event loop started by [`runModal(for:)`](/documentation/AppKit/NSApplication/runModal(for:)) or [`runModalSession(_:)`](/documentation/AppKit/NSApplication/runModalSession(_:)).

[`beginModalSession(for:)`](/documentation/AppKit/NSApplication/beginModalSession(for:))

Sets up a modal session with the given window and returns a pointer to the `NSModalSession` structure representing the session.

[`runModalSession(_:)`](/documentation/AppKit/NSApplication/runModalSession(_:))

Runs a given modal session, as defined in a previous invocation of [`beginModalSession(for:)`](/documentation/AppKit/NSApplication/beginModalSession(for:)).

[`modalWindow`](/documentation/AppKit/NSApplication/modalWindow)

The modal window displayed by the app.

[`NSApplication.ModalResponse`](/documentation/AppKit/NSApplication/ModalResponse)

A set of button return values for modal dialogs.

[`NSApplication.ModalSession`](/documentation/AppKit/NSApplication/ModalSession)

Variables of type `NSModalSession` point to information used by the system between `NSApplication`’s [`beginModalSession(for:)`](/documentation/AppKit/NSApplication/beginModalSession(for:)) and [`endModalSession(_:)`](/documentation/AppKit/NSApplication/endModalSession(_:)) messages.

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

The mode set when waiting for input from a modal panel, such as a save or open panel.

### Managing Panels

[`orderFrontColorPanel(_:)`](/documentation/AppKit/NSApplication/orderFrontColorPanel(_:))

Brings up the color panel, an instance of `NSColorPanel`.

[`orderFrontStandardAboutPanel(_:)`](/documentation/AppKit/NSApplication/orderFrontStandardAboutPanel(_:))

Displays a standard About window.

[`orderFrontStandardAboutPanel(options:)`](/documentation/AppKit/NSApplication/orderFrontStandardAboutPanel(options:))

Displays a standard About window with information from a given options dictionary.

[`orderFrontCharacterPalette(_:)`](/documentation/AppKit/NSApplication/orderFrontCharacterPalette(_:))

Opens the character palette.

[`runPageLayout(_:)`](/documentation/AppKit/NSApplication/runPageLayout(_:))

Displays the receiver’s page layout panel, an instance of `NSPageLayout`.

[`NSApplication.AboutPanelOptionKey`](/documentation/AppKit/NSApplication/AboutPanelOptionKey)

Keys to include in the options dictionary when displaying an About panel.



---

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)