### Add Compose Action Menu Dependency Source: https://github.com/jacobras/composeactionmenu/blob/main/README.md Include the library dependency in your project's build.gradle file. Ensure you are using the correct version for your Compose and Material Design setup. ```kotlin dependencies { implementation("nl.jacobras:compose-action-menu:3.1.1") } ``` -------------------------------- ### Create a Basic Toolbar Action Menu Source: https://github.com/jacobras/composeactionmenu/blob/main/README.md Define a list of regular action items and display them in a TopAppBar using the ActionMenu composable. Ensure you have the necessary string resources and icon vectors defined. ```kotlin val toolbarActions = listOf( RegularActionItem( key = "search", title = stringResource(R.string.search), iconVector = Icons.Filled.Search, onClick = { /* TODO: Open search screen */ } ) ) TopAppBar( actions = { ActionMenu(items = toolbarActions) } ) ``` -------------------------------- ### Test Action Menu Item Click Source: https://github.com/jacobras/composeactionmenu/blob/main/README.md Interact with menu items in tests by using the `onNodeWithTag` matcher with the generated test tag format "ActionMenu#". This allows simulating user clicks on specific actions. ```kotlin // Menu configuration: val item = RegularActionItem(key = "myKey", /* ... */) // Test: composeTestRule.onNodeWithTag("ActionMenu#myKey").performClick() ``` -------------------------------- ### Create a Grouped Action Item Source: https://github.com/jacobras/composeactionmenu/blob/main/README.md Construct a GroupActionItem by defining sub-options as RegularActionItems and passing them in the 'childOptions' list. This is useful for organizing related actions. ```kotlin val subOption1 = RegularActionItem(key = "subOption1", /* ... */) val subOption2 = RegularActionItem(key = "subOption2", /* ... */) val subOption3 = RegularActionItem(key = "subOption3", /* ... */) val group = GroupActionItem( key = "myGroup", title = stringResource(R.string.group_title), childOptions = listOf(subOption1, subOption2, subOption3) ) ``` -------------------------------- ### Migrate Action Item Resources from v1 to v2 Source: https://github.com/jacobras/composeactionmenu/blob/main/README.md In version 2.x and newer, Android-specific resource IDs for titles and icons are replaced with direct string and Painter resources. Update your RegularActionItem definitions accordingly. ```kotlin RegularActionItem( titleResId = R.string.search, iconDrawable = R.drawable.search ) ``` ```kotlin RegularActionItem( title = stringResource(R.string.search), icon = painterResource(R.drawable.search) ) ``` -------------------------------- ### Migrate ActionMenu Colors from Material 2 to Material 3 Source: https://github.com/jacobras/composeactionmenu/blob/main/README.md When migrating from version 2.x to 3.x, the color parameters for ActionMenu have changed. Update your color definitions to use ActionMenuDefaults.colors. ```kotlin ActionMenu( items = listOf(/* items */), colors = DefaultActionMenuColors( dropdownIconTint = myContentColor, dropdownBackgroundColor = myOverflowContainerColor ) ) ``` ```kotlin ActionMenu( items = listOf(/* items */), colors = ActionMenuDefaults.colors( contentColor = myContentColor, overflowContainerColor = myOverflowContainerColor, overflowContentColor = myContentColor ) ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.