PopupAnchor
A hoistable handle naming the component a menu opens against, bound to one with popupAnchor.
val anchor = rememberPopupAnchor()
var expanded by remember { mutableStateOf(false) }
Button("File", onClick = { expanded = true }, modifier = SwingModifier.popupAnchor(anchor))
PopupMenu(anchor, expanded, onDismiss = { expanded = false }) {
MenuItem("Open", onClick = { })
}Content copied to clipboard
An anchor names at most one component: binding it to a second one moves it there and leaves the first unbound.