---
title: "rectForCancelButton(whenCentered:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nssearchfield/rectforcancelbutton(whencentered:)"
---

# rectForCancelButton(whenCentered:)

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

## Declaration

```swift
func rectForCancelButton(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 doc://com.apple.appkit/documentation/AppKit/NSSearchField/centersPlaceholder.

## See Also

### Deprecated Symbols

- [centersPlaceholder](appkit/nssearchfield/centersplaceholder.md)
- [rectForSearchButton(whenCentered:)](appkit/nssearchfield/rectforsearchbutton(whencentered:).md)
- [rectForSearchText(whenCentered:)](appkit/nssearchfield/rectforsearchtext(whencentered:).md)
