NoContentItem
fun DropdownMenuItemColumnScope.NoContentItem(modifier: Modifier = Modifier, text: String = stringResource(R.string.spark_dropdown_menu_item_no_result_label))
Displays a "no content" text item.
This item is typically used to indicate that no results were found or that there are no available options in the dropdown. It can be used in any DropdownMenu variants which means it's available for all Dropdowns and ComboBoxs
Parameters
modifier
The modifier to be applied to the item.
text
The no result text. Defaults to a localized "No results".
Example usage:
SingleChoiceExposedDropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) {
if (filteredItems.isEmpty()) {
NoContentItem()
} else {
filteredItems.forEach { item ->
DropdownMenuItem(
text = { Text(item.label) },
onClick = {
selectedItem = item
expanded = false
},
)
}
}
}Content copied to clipboard