API reference
API reference
Select your platform
No SDKs available
No versions available

SpatialDropdown Function

Modifiers: final
Dropdowns group multiple options under a single header and display the active selection. They keep items hidden until the user clicks the primary chevron. This offers a neat way to manage numerous options within one component.

Signature

fun SpatialDropdown(items: List<SpatialDropdownItem>, onItemSelected: (SpatialDropdownItem) -> Unit, modifier: Modifier, filled: Boolean = true, leading: () -> Unit? = null, title: String? = null, subtitle: String? = null, enabled: Boolean = true, selectedItem: SpatialDropdownItem? = null, showChevron: Boolean = true, menuModifier: Modifier, showDividers: Boolean = false)

Parameters

items: List
The list of items to be displayed in the dropdown.
onItemSelected: Function1
The callback to be invoked when an item is selected.
modifier: Modifier
The Modifier to be applied to this dropdown.
filled: Boolean
Whether the dropdown is filled or not. Defaults to true.
leading: Function0?
A composable function that provides the leading icon for the dropdown.
title: String?
The title text of the dropdown.
subtitle: String?
The subtitle text of the dropdown.
enabled: Boolean
Whether the dropdown is enabled or disabled.
selectedItem: SpatialDropdownItem?
The currently selected item in the dropdown.
showChevron: Boolean
Whether to show the chevron, in the case of a pill variant. Defaults to true.
menuModifier: Modifier
The Modifier to be applied to the menu.
showDividers: Boolean
Whether to show dividers between items. Defaults to false.
Did you find this page helpful?