SearchTopAppBar
A top app bar whose title slot swaps for a search field.
It is the MainTopAppBar of a screen that filters what is behind it: the same navigation icon, overflow action and destination actions, with the title crossfading into a GeneralTextFieldStyle.Search field while showSearch is true. The bar owns only that swap; the query and whether search is showing stay with the caller, so the same state drives the bar and the filtering underneath it.
Both states share one fixed-height slot and fade in place, so neither the title nor the placeholder moves while they swap. The title animates between values the way MainTopAppBar's does. The state the bar is first composed in is shown without an entrance, so a screen that opens straight into search does not flash its title, and the title still appears the first time search is turned off.
Filters are optional and go in filters, the row that sits inside the field, to the left of the clear button. SearchFilterAction is the ready-made toggle for one: it renders tonally while the filter is applied and as text while it is not, so an active sort or filter reads as active without a second surface. Actions that belong to the bar rather than to the query go in actions.
The Support overflow item is rendered only when the host supplies onSupportClick, matching MainTopAppBar, so this module stays free of any dependency on a support feature.
Parameters
Shown while showSearch is false; defaults to the host's app name.
The ImageVector drawn as the navigation icon, or null for none.
Invoked when the navigation icon is clicked.
Whether the search field replaces the title.
The current query.
Receives every edit, including the clear button's empty string.
The Modifier applied to the bar.
Shown while the field is empty.
Accessibility description of the clear button.
Whether the title is centered; the search field always fills the slot.
Called when the keyboard's search action is used. A filter that already applied itself as the query was typed needs nothing here.
Row placed inside the search field, before the clear button. Empty by default.
Destination-owned app bar actions, drawn after the Support overflow.
Host callback that opens Support. The overflow action is hidden when it is null, so hosts without a support surface get no dead menu entry.
Whether to render the Support overflow action when a callback exists.
Applied to the bar, defining how it behaves as content is scrolled.
Insets the bar consumes.