Dropdown Menus

In Dropdowns

Simple dropdown

/**
 * Add the following dependency to your build.gradle.kts:
 *
 * dependencies {
 *      implementation("com.composables:core:1.11.0")
 * }
 */
 
Box(Modifier.height(300.dp).fillMaxWidth()) {
    Menu(modifier = Modifier.align(Alignment.TopCenter).width(240.dp), state = rememberMenuState(expanded = true)) {
        MenuButton(
            Modifier.clip(RoundedCornerShape(6.dp)).background(Color.White)
                .border(1.dp, Color(0xFFBDBDBD), RoundedCornerShape(6.dp))
        ) {
            Row(
                verticalAlignment = Alignment.CenterVertically,
                modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp)
            ) {
                BasicText("Options", style = TextStyle(fontWeight = FontWeight(500)))
                Spacer(Modifier.width(4.dp))
                Image(Icons.Rounded.KeyboardArrowDown, null)
            }
        }

        MenuContent(
            modifier = Modifier.padding(top = 4.dp).width(320.dp).clip(RoundedCornerShape(6.dp))
                .border(1.dp, Color(0xFFE0E0E0), RoundedCornerShape(6.dp)).background(Color.White).padding(4.dp),
            exit = fadeOut()
        ) {
            MenuItem(modifier = Modifier.clip(RoundedCornerShape(6.dp)), onClick = { /* TODO handle click */ }) {
                BasicText("Option 1", Modifier.fillMaxWidth().padding(vertical = 10.dp, horizontal = 10.dp))
            }
            MenuItem(modifier = Modifier.clip(RoundedCornerShape(6.dp)), onClick = { /* TODO handle click */ }) {
                BasicText("Option 2", Modifier.fillMaxWidth().padding(vertical = 10.dp, horizontal = 10.dp))
            }
            MenuItem(modifier = Modifier.clip(RoundedCornerShape(6.dp)), onClick = { /* TODO handle click */ }) {
                BasicText("Option 3", Modifier.fillMaxWidth().padding(vertical = 10.dp, horizontal = 10.dp))
            }
        }
    }
}
In Dropdowns

Dropdown with separators

Get code →
In Dropdowns

Dropdown with icons

Get code →
In Dropdowns

Dropdown with icon button

Get code →
Sit tight. We are loading your preview
🐛 Bugs & Suggestions