PdfSelectionMenu
The selection context menu: place it in PdfView's overlay slot and it appears whenever text is selected, listing items and, when highlightColors is non-empty, a wrapping row of colour swatches.
It waits for the finger to lift. While PdfViewState.selectionInProgress is true the menu stays hidden, because a popup over the page mid-drag covers the very words being chosen; it appears the moment the drag ends.
Every visual layer is replaceable:
container swaps the card the menu sits in (the default is a white rounded card); its
contentargument is the laid-out menu body.itemContent swaps how one action renders (the default is a pill chip).
colorSwatch swaps how one colour renders (the default is a circle).
For a completely different menu, skip this composable and build your own against PdfViewState.selection and PdfViewState.selectionInProgress; this one is the default, not the contract.
PdfView(state, overlay = {
PdfSelectionMenu(
state = state,
items = listOf(
PdfSelectionMenuItem("Copy") { clipboard.setText(AnnotatedString(it.text)) },
PdfSelectionMenuItem("Highlight") { marks.add(it) },
),
highlightColors = listOf(Color.Yellow, Color.Green, Color.Cyan),
onHighlightColorPicked = { sel, color -> marks.add(sel, color) },
)
})