Adds an item to the list of text context menu components.
AppendItemToTextContextMenuAndroid
@Composable
fun AppendItemToTextContextMenuAndroid() {
val textFieldState = rememberTextFieldState()
val label = stringResource(R.string.context_menu_clear)
BasicTextField(
state = textFieldState,
modifier =
Modifier.appendTextContextMenuComponents {
separator()
item(
key = ClearKeyDataObject,
label = label,
leadingIcon = R.drawable.ic_sample_vector,
) {
textFieldState.clearText()
close()
}
separator()
},
)
}