Search Bar

A text field with built-in listeners specially catered to search features (onQueryChange, onSearch).

  • In the expanded state, SearchBar will fill its container's width and height. The alternative DockedSearchBar is more flexible as it does not fill its container's width.
  • SearchBar will throw a vague Exception if its container's height is unspecified.
  • SearchBar itself mostly handles the decor; anything related to typing is managed by SearchBarDefaults.InputField.
  • Clicking on a search result list item will not trigger InputField#onSearch(). This makes sense since onSearch() is a function of InputField. InputField#onSearch() can be triggered by pressing the ENTER key on the soft keyboard.
Compose Multiplatform

Docked Search Bar

DockedSearchBar is a variation of SearchBar that doesn't fill its container's width.

Compose Multiplatform