SearchBar

fun TileSchemaBuilderScope.SearchBar(id: String = randomId(), events: EventSchemaBuilderScope.() -> Unit = {}, style: StyleSchemaBuilderScope.() -> Unit = {}, visibility: TileSchema.Visibility = visible(), searchableTerms: List<String>? = null, query: String = "", placeholder: String? = null, leadingIcon: TileSchemaBuilderScope.() -> Unit? = null, trailingIcon: TileSchemaBuilderScope.() -> Unit? = null)

Renders a Material search field showing query, with placeholder shown when empty. The keyboard's IME action is always "Search". leadingIcon is an arbitrary tile rendered in the leading slot. The trailing slot is shared: while query is empty it shows trailingIcon (if any); as soon as query has text it cross-fades to a built-in clear icon button, so a custom trailing icon is never visible at the same time as the clear button. Typing and pressing clear update the query locally on the client (no server round trip needed for the text to change). This is only the input field — it has no expanded state and shows no suggestion list; pair it with e.g. a LazyColumn whose filterChildrenByTerm is driven by the query to render results. Dispatches onQueryChanged (carrying the new text) on every keystroke and also when clear is pressed (with an empty string); onQueryCleared when the clear button is pressed, right before the query-changed trigger; and onSearch (carrying the current query) when the IME "Search" action is pressed.

Parameters

id

Unique identifier of the tile. Defaults to a random id.

events

Events owned by this tile, wired to its triggers (onQueryChanged, onQueryCleared, onSearch).

style

Layout/appearance modifiers (size, padding, background, etc).

visibility

Whether the tile is shown, hidden but occupies space, or removed from layout. Defaults to visible.

searchableTerms

Terms used by an ancestor's search/filter to decide whether this tile matches. Defaults to none.

query

Current text shown in the field. Defaults to empty.

placeholder

Text shown when the field is empty. Defaults to none.

leadingIcon

Tile rendered in the leading slot. Defaults to none.

trailingIcon

Tile rendered in the trailing slot while query is empty; replaced by a clear button once it has text. Defaults to none.