SearchBarTileSchema

@Serializable
@SerialName(value = "SearchBar")
data class SearchBarTileSchema(val id: String, val events: SerializableImmutableList<EventSchema>?, val style: StyleSchema, val searchableTerms: SerializableImmutableList<String>?, val visibility: TileSchema.Visibility, val query: String = "", val placeholder: String? = null, val leadingIcon: TileSchema? = null, val trailingIcon: TileSchema? = null) : TileSchema

Renders a search field: a Material Surface (extra-large shape, high surface container color) wrapping a single-line text field showing query, with placeholder when empty. The keyboard's IME action is always "Search".

Icons: 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.

Query state: typing dispatches a local SearchBarTileEvents.OnQueryChanged and pressing clear dispatches OnQueryCleared; the holder applies both to its own state, so the text survives without a round trip to the server.

Triggers dispatched:

  • OnQueryChangedEventTrigger — on every keystroke, with the new text as the event's incoming data. Pressing clear also fires it, with an empty string.

  • OnQueryClearedEventTrigger — when the clear button is pressed, right before the query-changed trigger above.

  • OnSearchEventTrigger — when the IME "Search" action is pressed, with the current query as the event's incoming data.

Notes: this is only the input field — it has no expanded state and shows no suggestion list. Render results yourself, e.g. by pairing it with a LazyColumn whose filterChildrenByTerm is driven by the query.

Constructors

Link copied to clipboard
constructor(id: String, events: SerializableImmutableList<EventSchema>?, style: StyleSchema, searchableTerms: SerializableImmutableList<String>?, visibility: TileSchema.Visibility, query: String = "", placeholder: String? = null, leadingIcon: TileSchema? = null, trailingIcon: TileSchema? = null)

Properties

Link copied to clipboard
@SerialName(value = "events")
open override val events: SerializableImmutableList<EventSchema>?
Link copied to clipboard
@SerialName(value = "id")
open override val id: String
Link copied to clipboard
@SerialName(value = "leadingIcon")
val leadingIcon: TileSchema?
Link copied to clipboard
@SerialName(value = "placeholder")
val placeholder: String?
Link copied to clipboard
@SerialName(value = "query")
val query: String
Link copied to clipboard
@SerialName(value = "searchableTerms")
open override val searchableTerms: SerializableImmutableList<String>?
Link copied to clipboard
@SerialName(value = "style")
open override val style: StyleSchema
Link copied to clipboard
@SerialName(value = "trailingIcon")
val trailingIcon: TileSchema?
Link copied to clipboard
@SerialName(value = "visibility")
open override val visibility: TileSchema.Visibility

Functions

Link copied to clipboard
open fun isGone(): Boolean
Link copied to clipboard
open fun isVisible(): Boolean