name thatuiuser interface

Recent Searches

Type for the cancel button; click the magnifier for the recents menu

Search Field

/ NSSearchField · View.searchable(text:placement:prompt:) /

also called search box, search bar, NSSearchField, searchable field

A search field is a text input specialized for filtering or finding content. On macOS it normally includes a magnifying-glass search button, a cancel button that appears for a nonempty query, and optionally a menu of recent searches. SwiftUI's searchable modifier places the platform search field in an appropriate location such as the toolbar.

Anatomy — every part, named

  1. 1
    Search buttonNSSearchFieldCell.searchButtonCell

    The magnifying glass inside the leading edge is the search button, not just a decorative placeholder icon.

  2. 2
    Cancel buttonNSSearchFieldCell.cancelButtonCell

    “The little x that clears the search” is the field's cancel button.

  3. 3
    Recent-searches menuNSSearchFieldCell.searchMenuTemplate

    The menu attached to the search icon can list recent queries and a Clear Recents command.

Prompt — paste into your agent

Use a native Search Field with NSSearchField (SwiftUI: View.searchable), preserving its leading search button, trailing cancel button when text is present, and optional recent-search menu from NSSearchFieldCell.searchMenuTemplate.

In code

The exact names this thing goes by in code — each row is one framework’s word for it. Use the row that matches your project (or paste it into your prompt).

AppKitNSSearchField
SwiftUIView.searchable(text:placement:prompt:)
AppKitNSSearchFieldCell

See also

Search

Describe the UI element you're thinking of