Editor contains four types of search fields:
A toolbar search field is an input field in toolbars that allows users to enter text to be searched for.
A toolbar search field with a pop-up (dropdown menu) used for filtering search queries.
IMGUI
A condensed search field may be used to simplify the UI when search is not a primary functionality in the area.
Use a popup search field if a dropdown menu is needed to filter search queries.
Search fields appear in toolbars and follow the same principles as other toolbar controls.
Recommended minimum width:
To allow for legible user input, the recommended minimum width for search fields are 150 px, or 20 characters.
The condensed search field in its collapsed state adapts its styling to the context in which it appears, matching the appearance of other icon buttons in the area.
Search results of a query is displayed immediately while a user is typing.
Toolbar pop-up search fields allows users to set object type filters for their search query with a dropdown menu.
In its collapsed state, the condensed search field appears as an icon button with a search icon. Clicking on the search button expands the condensed search field into a regular search field and a collapse button, and automatically places focus on the search field.
Clicking on the collapse button collapses the condensed search field back into its collapsed state. If the search field is empty, clicking outside of the search field removes focus from it and automatically collapses it. If there is input in the search field, clicking outside of the Search Field does not automatically collapse it.
A search field can contain following elements:
1. Search / popup search icons
2. Clear icon
3. Body (container)
4. User input
5. Filter label (popup search fields)
6. Popup menu
7. Condensed search button
8. Collapse button
Pop-up search icon is used to open the dropdown menu.
Used to clear user input.
The body of the search field is the container where content (icons, user input, filter label) is displayed.
The search query input by the user inside the search field.
Label of the selected filter in pop up search fields.
Condensed state of the condensed search field appears as an icon button.
Collapse button used to collapse a condensed search field from its expanded state.
Default state of a search field.
When hovering over a search field body the border will be highlighted. Additionally, the user’s default cursor will switch to a line cursor glyph to indicate the nature of the element.
When a search field enters the focused state its content will be highlighted in addition to its borders. This is because the content is being selected, allowing for the user to interact with it immediately (for example by immediately deleting or copying all of it).
A search field that is disabled will indicate so by having its body “greyed out” and will not accept inputs or react to hovering.
A collapsed condensed search field appears as a search icon button.
A search field that is disabled will indicate so by having its body “greyed out” and will not accept inputs or react to hovering.
Go to Window > UI Toolkit > Samples, to view code samples in C# / USS / UXML.
UI Toolkit
Unity - Scripting API:
ToolbarSearchField
Unity - Scripting API:
ToolbarPopupSearchField
IMGUI