Skip to content

Extra

DropdownMenu

A FormaUI dropdown menu — a transient surface of choices anchored to a control, delegating to Material 3's DropdownMenu.

dev.formaui.components.menu

item with leading iconitem with trailing shortcut hintdisabled item

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 expanded by remember { mutableStateOf(false) }
Box {
    FormaIconButton(onClick = { expanded = true }) { Text("⋮") }
    FormaDropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) {
        FormaDropdownMenuItem(text = "Share", onClick = { expanded = false })
        FormaDropdownMenuItem(text = "Delete", onClick = { expanded = false })
    }
}

FormaDropdownMenu

Popup menu anchored to a sibling control; visibility is hoisted via expanded/onDismissRequest.

expandedrequiredTypeBooleanDefaultrequiredDescriptionwhether the menu is currently shown.
onDismissRequestrequiredType() -> UnitDefaultrequiredDescriptioncalled when the user requests to dismiss the menu — an outside tap or the back gesture.
modifierTypeModifierDefaultModifierDescriptionthe Modifier applied to the menu's content.
contentrequiredType@Composable ColumnScope.() -> UnitDefaultrequiredDescriptionthe menu's items, laid out in a scrollable ColumnScope (typically FormaDropdownMenuItems).

FormaDropdownMenuItem

A single choice in a FormaDropdownMenu, delegating to Material 3's DropdownMenuItem.

textrequiredTypeStringDefaultrequiredDescriptionthe item's label.
onClickrequiredType() -> UnitDefaultrequiredDescriptioncalled when the item is clicked. Not invoked while enabled is false. Callers typically also dismiss the menu from here.
modifierTypeModifierDefaultModifierDescriptionthe Modifier applied to the item.
leadingIconType@Composable (() -> Unit)?DefaultnullDescriptionoptional slot at the start of the item.
trailingIconType@Composable (() -> Unit)?DefaultnullDescriptionoptional slot at the end of the item (can also hold Text for a keyboard shortcut hint).
enabledTypeBooleanDefaulttrueDescriptionwhether the item is interactive.

Accessibility

The menu renders in its own popup and routes an outside tap or the back gesture to onDismissRequest. FormaDropdownMenuItem's text is a real Text, so each item announces its own label; treat leadingIcon/trailingIcon as decorative (contentDescription = null) since they repeat it.