Extra
SearchBar
A FormaUI search bar — "Material 3 with better defaults", wrapping Material 3's SearchBar/DockedSearchBar behind one entry point whose variant switches between the docked and full-screen expansion surfaces.
import dev.formaui.components.search.FormaSearchBar
Preview
This toggle is site chrome only — the preview has its own light/dark switch inside.
Live preview — ~37 MB development build
Usage
var query by remember { mutableStateOf("") }var expanded by remember { mutableStateOf(false) }FormaSearchBar( query = query, onQueryChange = { query = it }, onSearch = { expanded = false }, expanded = expanded, onExpandedChange = { expanded = it }, variant = FormaSearchBarVariant.Docked, placeholder = { Text("Search contacts") }, leadingIcon = { Text("🔍") },) { Text("Ada Lovelace")}
FormaSearchBar
Search input that expands into a Docked results panel or a FullScreen overlay; query and expansion state are both hoisted.
Supporting API
- FormaSearchBarVariantenum
- The surface the search bar expands into; values: Docked, FullScreen.
- FormaSearchBarDefaultsobject
- Default values: dockedShape, fullScreenCollapsedShape, TonalElevation, ShadowElevation.
Accessibility
The input field carries Material 3's text-field semantics, and expansion stays hoisted — onExpandedChange fires both when the field gains focus and on back navigation, so the caller owns the collapse. A search-glyph leadingIcon is decorative (contentDescription = null); give trailingIcon a description when it is an action such as clear.