Extra
ExposedDropdownMenu
A FormaUI exposed dropdown menu (autocomplete) — a FormaTextField anchor that drops a menu of options below it, delegating to Material 3's ExposedDropdownMenuBox. Fully hoisted (query text, expanded state, and the already-filtered options are the caller's); FormaUI provides the wiring, the rotating chevron, and the option rows. Generic over the option type via optionLabel.
dev.formaui.components.autocomplete
Preview
This toggle is site chrome only — the preview has its own light/dark switch inside.
Live preview
Live preview — ~37 MB development build
Usage
var text by remember { mutableStateOf("") }
var expanded by remember { mutableStateOf(false) }
val matches = countries.filter { it.contains(text, ignoreCase = true) }
FormaExposedDropdownMenu(
expanded = expanded,
onExpandedChange = { expanded = it },
value = text,
onValueChange = { text = it },
options = matches,
onOptionSelected = { text = it },
optionLabel = { it },
label = "Country",
)Supporting API
- FormaExposedDropdownMenuDefaultsobject
- Defaults for FormaExposedDropdownMenu: NoMatchesText ("No matches") — the label of the disabled empty-options row.
Accessibility
The rotating chevron trailing icon and the anchor's expand/collapse + option semantics are handled by Material 3's ExposedDropdownMenuBox / menuAnchor; the trailing icon is the standard M3 ExposedDropdownMenuDefaults.TrailingIcon. The field's error state is surfaced to accessibility services by the underlying FormaTextField.