<!--
{
  "availability" : [
    "macOS: 10.11.0 - 12.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSearchField/rectForSearchButton(whenCentered:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSSearchField(im)rectForSearchButtonWhenCentered:"
  },
  "title" : "rectForSearchButton(whenCentered:)"
}
-->

# rectForSearchButton(whenCentered:)

The rectangle for the search button within the bounds of the search field.

```
func rectForSearchButton(whenCentered isCentered: Bool) -> NSRect
```

## Parameters

`isCentered`

A Boolean value that indicates whether the search field’s components are centered within the control. For more information, see [`centersPlaceholder`](/documentation/AppKit/NSSearchField/centersPlaceholder).

## Discussion

---

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)