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

# NSDrawer

A user interface element that contains and displays text, scroll, and browser views, in addition to other view subclasses.

```
class NSDrawer
```

## Overview

A drawer is associated with a window, called its parent, and can appear only while its parent is visible onscreen. A drawer cannot be moved or ordered independently of a window, but is instead attached to one edge of its parent and moves along with it.

## Topics

### Creating Drawers

[`-  initWithContentSize:preferredEdge:`](/documentation/AppKit/NSDrawer/init(contentSize:preferredEdge:))

Creates a new drawer with the given size on the specified edge of the parent window.

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

The receiver’s delegate.

### Opening and Closing Drawers

[`-  close`](/documentation/AppKit/NSDrawer/close())

If the receiver is open, this method closes it.

[`-  close:`](/documentation/AppKit/NSDrawer/close(_:))

An action method to close the receiver.

[`-  open`](/documentation/AppKit/NSDrawer/open())

If the receiver is closed, this method opens it.

[`-  open:`](/documentation/AppKit/NSDrawer/open(_:))

An action method to open the drawer.

[`-  openOnEdge:`](/documentation/AppKit/NSDrawer/open(on:))

Causes the receiver to open on the specified edge of the parent window.

[`-  toggle:`](/documentation/AppKit/NSDrawer/toggle(_:))

Toggles the drawer open or closed.

[`state`](/documentation/AppKit/NSDrawer/state-swift.property)

The state of the receiver.

### Managing Drawer Size

[`contentSize`](/documentation/AppKit/NSDrawer/contentSize)

The size of the receiver’s content area.

[`leadingOffset`](/documentation/AppKit/NSDrawer/leadingOffset)

The receiver’s leading offset.

[`maxContentSize`](/documentation/AppKit/NSDrawer/maxContentSize)

The maximum allowed size of the receiver’s content area.

[`minContentSize`](/documentation/AppKit/NSDrawer/minContentSize)

The minimum allowed size of the receiver’s content area.

[`trailingOffset`](/documentation/AppKit/NSDrawer/trailingOffset)

The receiver’s trailing offset.

### Managing Drawer Edges

[`edge`](/documentation/AppKit/NSDrawer/edge)

The edge of the window that the receiver is connected to.

[`preferredEdge`](/documentation/AppKit/NSDrawer/preferredEdge)

The receiver’s preferred, or default, edge.

### Managing Drawer Views

[`contentView`](/documentation/AppKit/NSDrawer/contentView)

The receiver’s content view.

[`parentWindow`](/documentation/AppKit/NSDrawer/parentWindow)

The receiver’s parent window.

### Constants

[`State`](/documentation/AppKit/NSDrawer/State-swift.enum)

These constants specify the possible states of a drawer.

### Notifications

[`NSDrawerDidCloseNotification`](/documentation/AppKit/NSDrawer/didCloseNotification)

Posted whenever the drawer is closed.

[`NSDrawerDidOpenNotification`](/documentation/AppKit/NSDrawer/didOpenNotification)

Posted whenever the drawer is opened.

[`NSDrawerWillCloseNotification`](/documentation/AppKit/NSDrawer/willCloseNotification)

Posted whenever the drawer is about to close.

[`NSDrawerWillOpenNotification`](/documentation/AppKit/NSDrawer/willOpenNotification)

Posted whenever the drawer is about to open.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

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

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

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

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

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

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

### Inherits From

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

---

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)