---
title: searchField
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nssearchtoolbaritem/searchfield
---

# searchField

The search field inside the toolbar item.

## Declaration

```swift
var searchField: NSSearchField { get set }
```

## Discussion

Discussion When you set searchField to nil, it uses the default configuration for the toolbar item, and inherits the item’s properties and layout constraints. However, if you want to customize the search field, you’ll need to add those settings before assigning it to the toolbar item. For more information about customizing a search field, see NSSearchField.

## See Also

### Configuring a search item

- [preferredWidthForSearchField](appkit/nssearchtoolbaritem/preferredwidthforsearchfield.md)
- [resignsFirstResponderWithCancel](appkit/nssearchtoolbaritem/resignsfirstresponderwithcancel.md)
