---
title: "standardWindowButton(_:for:)"
framework: appkit
role: symbol
role_heading: Type Method
path: "appkit/nswindow/standardwindowbutton(_:for:)"
---

# standardWindowButton(_:for:)

Returns a new instance of a given standard window button, sized appropriately for a given window style.

## Declaration

```swift
class func standardWindowButton(_ b: NSWindow.ButtonType, for styleMask: NSWindow.StyleMask) -> NSButton?
```

## Parameters

- `b`: The type of standard window button to return.
- `styleMask`: The window style for which b is to be sized. See doc://com.apple.appkit/documentation/AppKit/NSWindow/StyleMask-swift.struct for the list of allowable values.

## Return Value

Return Value The new window button of the type identified by b; nil when no such button type exists.

## Discussion

Discussion The caller is responsible for adding the button to the view hierarchy and for setting the target to be the window.

## See Also

### Managing Title Bars

- [standardWindowButton(_:)](appkit/nswindow/standardwindowbutton(_:).md)
- [showsToolbarButton](appkit/nswindow/showstoolbarbutton.md)
- [titlebarAppearsTransparent](appkit/nswindow/titlebarappearstransparent.md)
- [toolbarStyle](appkit/nswindow/toolbarstyle-swift.property.md)
- [NSWindow.ToolbarStyle](appkit/nswindow/toolbarstyle-swift.enum.md)
- [titlebarSeparatorStyle](appkit/nswindow/titlebarseparatorstyle.md)
- [NSTitlebarSeparatorStyle](appkit/nstitlebarseparatorstyle.md)
- [windowTitlebarLayoutDirection](appkit/nswindow/windowtitlebarlayoutdirection.md)
