Skip to content

WindowDropdown

WindowDropdown is a dropdown menu component in Miuix that provides a title, summary, and a list of dropdown options. It renders at the window level without needing a Scaffold host, making it suitable for use cases where Scaffold is not available or desired.

Import

kotlin
import top.yukonga.miuix.kmp.extra.WindowDropdown

Basic Usage

The WindowDropdown component provides basic dropdown menu functionality:

kotlin
var selectedIndex by remember { mutableStateOf(0) }
val options = listOf("Option 1", "Option 2", "Option 3")

WindowDropdown(
    title = "Dropdown Menu",
    items = options,
    selectedIndex = selectedIndex,
    onSelectedIndexChange = { selectedIndex = it }
)
kotlin
var selectedIndex by remember { mutableStateOf(0) }
val options = listOf("中文", "English", "日本語")

WindowDropdown(
    title = "Language Settings",
    summary = "Choose your preferred language",
    items = options,
    selectedIndex = selectedIndex,
    onSelectedIndexChange = { selectedIndex = it }
)

Component States

Disabled State

kotlin
WindowDropdown(
    title = "Disabled Dropdown",
    summary = "This dropdown menu is currently unavailable",
    items = listOf("Option 1"),
    selectedIndex = 0,
    onSelectedIndexChange = {},
    enabled = false
)

Properties

WindowDropdown Properties

Property NameTypeDescriptionDefault ValueRequired
itemsList<String>List of dropdown options-Yes
selectedIndexIntIndex of currently selected item-Yes
titleStringTitle of the dropdown menu-Yes
modifierModifierModifier applied to the componentModifierNo
titleColorBasicComponentColorsTitle text color configurationBasicComponentDefaults.titleColor()No
summaryString?Summary description of dropdownnullNo
summaryColorBasicComponentColorsSummary text color configurationBasicComponentDefaults.summaryColor()No
dropdownColorsDropdownColorsColor configuration for dropdownDropdownDefaults.dropdownColors()No
startAction@Composable (() -> Unit)?Custom start side contentnullNo
bottomAction@Composable (() -> Unit)?Custom bottom side contentnullNo
insideMarginPaddingValuesInternal content paddingBasicComponentDefaults.InsideMarginNo
maxHeightDp?Maximum height of dropdown menunullNo
enabledBooleanWhether component is interactivetrueNo
showValueBooleanWhether to show the selected valuetrueNo
onSelectedIndexChange((Int) -> Unit)?Selection change callback-No
Property NameTypeDescription
contentColorColorOption text color
containerColorColorOption background color
selectedContentColorColorSelected item text color
selectedContainerColorColorSelected item background color

Changelog

Released under the Apache-2.0 License