public object MenuDefaults
Contains default values used for DropdownMenu and DropdownMenuItem.
Properties
DefaultMenuProperties
public val DefaultMenuProperties: PopupProperties = PopupProperties(focusable = true)
The default PopupProperties used in DropdownMenu and DropdownMenuPopup
TonalElevation
public val TonalElevation: Dp = ElevationTokens.Level0
The default tonal elevation for a menu.
ShadowElevation
public val ShadowElevation: Dp = MenuTokens.ContainerElevation
The default shadow elevation for a menu.
LeadingIconSize
public val LeadingIconSize: Dp = SegmentedMenuTokens.ItemLeadingIconSize
The default leading icon size for a menu item.
TrailingIconSize
public val TrailingIconSize: Dp
The default trailing icon size for a menu item.
shape
public val shape: Shape
The default shape for a menu.
containerColor
public val containerColor: Color
The default container color for a menu.
groupStandardContainerColor
public val groupStandardContainerColor: Color
The standard default container color for a group within a menu.
Menus have two color options: standard (surface based) vibrant (tertiary based)
These mappings provide options for lower or higher visual emphasis. Vibrant menus are more prominent so should be used sparingly.
groupVibrantContainerColor
public val groupVibrantContainerColor: Color
The vibrant default container color for a group within a menu.
Menus have two color options: standard (surface based) vibrant (tertiary based)
These mappings provide options for lower or higher visual emphasis. Vibrant menus are more prominent so should be used sparingly.
leadingGroupShape
public val leadingGroupShape: Shape
The default shape for the leading group of a menu.
middleGroupShape
public val middleGroupShape: Shape
The default shape for the middle group of a menu.
trailingGroupShape
public val trailingGroupShape: Shape
The default shape for the trailing group of a menu.
leadingItemShape
public val leadingItemShape: Shape
The default shape for the leading item of a menu or group.
middleItemShape
public val middleItemShape: Shape
The default shape for the middle item of a menu or group.
trailingItemShape
public val trailingItemShape: Shape
The default shape for the trailing item of a menu or group.
standaloneItemShape
public val standaloneItemShape: Shape
The default shape for a standalone item of a menu or group.
selectedItemShape
public val selectedItemShape: Shape
The selected shape for items of a group.
standaloneGroupShape
public val standaloneGroupShape: Shape
The default shape for a standalone group of a menu.
inactiveGroupShape
public val inactiveGroupShape: Shape
The shape for a group of a menu that is no longer being hovered.
GroupSpacing
public val GroupSpacing: Dp = SegmentedMenuTokens.SegmentedGap
The default spacing between each menu group. Usually used in a Spacer's height
HorizontalDividerPadding
public val HorizontalDividerPadding: PaddingValues =
PaddingValues(horizontal = 12.dp, vertical = 2.dp)
The default padding for a HorizontalDivider used in a menu group. Use this padding value in a HorizontalDivider's padding modifier.
DropdownMenuGroupLabelHorizontalPadding
public val DropdownMenuGroupLabelHorizontalPadding: PaddingValues =
PaddingValues(start = 12.dp, end = 4.dp)
The default horizontal padding for a menu group label. Please see MenuDefaults.DropdownMenuGroupLabel.
DropdownMenuItemTrailingLabelHorizontalPadding
public val DropdownMenuItemTrailingLabelHorizontalPadding: PaddingValues
The default horizontal padding for a menu group trailing label. Please see MenuDefaults.DropdownMenuItemTrailingLabel.
DropdownMenuItemHorizontalArrangement
public val DropdownMenuItemHorizontalArrangement: Arrangement.Horizontal
Default horizontal arrangement for a menu item.
DropdownMenuItemContentPadding
public val DropdownMenuItemContentPadding: PaddingValues =
PaddingValues(horizontal = DropdownMenuItemHorizontalPadding, vertical = 0.dp)
Default padding used for DropdownMenuItem.
DropdownMenuSelectableItemContentPadding
public val DropdownMenuSelectableItemContentPadding: PaddingValues
Default padding used for DropdownMenuItem that are selectable.
DropdownMenuGroupContentPadding
public val DropdownMenuGroupContentPadding: PaddingValues =
PaddingValues(horizontal = 0.dp, vertical = DropdownMenuGroupVerticalPadding)
Default padding used for DropdownMenuGroup.
Functions
groupShape
@Composable
public fun groupShape(index: Int, count: Int): MenuGroupShapes
A MenuGroupShapes constructor that the group in index should have when there are count groups in the menu.
Parameters
| index | the index for this group in the menu. |
| count | the count of groups in this menu. |
itemShape
@Composable
public fun itemShape(index: Int, count: Int): MenuItemShapes
A MenuItemShapes constructor that the item in index should have when there are count items in the menu or group. If a DropdownMenuGroup is used, please pass the number of items within the group as count. If no DropdownMenuGroup is used, please pass the number of items in the entire menu as count.
Parameters
| index | the index for this item in the menu or group. |
| count | the count of items in this menu or group. |
itemColors
@Composable
public fun itemColors(): MenuItemColors
Creates a MenuItemColors that represents the default text and icon colors used in a DropdownMenuItemContent.
itemShapes
@Composable
public fun itemShapes(shape: Shape? = null, selectedShape: Shape? = null): MenuItemShapes
Creates a MenuItemShapes that represents the shapes used in a toggleable or selectable DropdownMenuItem, allowing for overrides.
There is a convenience function that can be used to easily determine the shape to be used at MenuDefaults.itemShape.
Parameters
| shape | the shape when unselected. It uses middleItemShape as the default if null is provided. |
| selectedShape | the shape when selected. It uses selectedItemShape as the default if null is provided. |
itemShapes
@Composable
public fun itemShapes(): MenuItemShapes
Creates a MenuItemShapes that represents the shapes used in a toggleable or selectable DropdownMenuItem.
There is a convenience function that can be used to easily determine the shape to be used at MenuDefaults.itemShape.
This MenuItemShapes has MenuDefaults.standaloneItemShape as the shape and MenuDefaults.selectedItemShape as the selected shape.
groupShapes
@Composable
public fun groupShapes(shape: Shape? = null, inactiveShape: Shape? = null): MenuGroupShapes
Creates a MenuGroupShapes that represents the default shapes used in a DropdownMenuGroup, allowing for overrides.
There is a convenience function that can be used to easily determine the shape to be used at MenuDefaults.groupShape.
Parameters
| shape | the default shape of the group. It uses standaloneGroupShape as the default if null is provided. |
| inactiveShape | the shape when no longer being hovered. It uses inactiveGroupShape as the default if null is provided. |
groupShapes
@Composable
public fun groupShapes(): MenuGroupShapes
Creates a MenuGroupShapes that represents the default shapes used in a DropdownMenuGroup.
This MenuGroupShapes has MenuDefaults.standaloneGroupShape as the shape and MenuDefaults.inactiveGroupShape as the inactive shape, the inactive shape is the shape of the group after it is no longer being hovered.
DropdownMenuGroupLabel
@Composable
public fun DropdownMenuGroupLabel(
modifier: Modifier = Modifier,
contentAlignment: Alignment = Alignment.CenterStart,
padding: PaddingValues = DropdownMenuGroupLabelHorizontalPadding,
content: @Composable () -> Unit,
)
The default label recommended to be used within a DropdownMenuGroup.
Labels can be used to categorize parts of the group or the entire group
Parameters
| modifier | the Modifier to be applied to this label. |
| contentAlignment | the alignment of the label's content. |
| padding | the padding applied to the label's content. |
| content | the content of the label. |
DropdownMenuItemTrailingLabel
@Composable
public fun DropdownMenuItemTrailingLabel(
modifier: Modifier = Modifier,
padding: PaddingValues = DropdownMenuItemTrailingLabelHorizontalPadding,
content: @Composable () -> Unit,
)
The default trailing label recommended to be used within a DropdownMenuItem which can be passed to its trailingIcon param.
Parameters
| modifier | the Modifier to be applied to this dropdown menu item trailing label. |
| padding | the padding applied to the label's content. |
| content | the content of the label. |
itemColors
@Composable
public fun itemColors(
textColor: Color = Color.Unspecified,
leadingIconColor: Color = Color.Unspecified,
trailingIconColor: Color = Color.Unspecified,
disabledTextColor: Color = Color.Unspecified,
disabledLeadingIconColor: Color = Color.Unspecified,
disabledTrailingIconColor: Color = Color.Unspecified,
): MenuItemColors
Creates a MenuItemColors that represents the default text and icon colors used in a DropdownMenuItemContent.
Parameters
| textColor | the text color of this DropdownMenuItemContent when enabled |
| leadingIconColor | the leading icon color of this DropdownMenuItemContent when enabled |
| trailingIconColor | the trailing icon color of this DropdownMenuItemContent when enabled |
| disabledTextColor | the text color of this DropdownMenuItemContent when not enabled |
| disabledLeadingIconColor | the leading icon color of this DropdownMenuItemContent when not enabled |
| disabledTrailingIconColor | the trailing icon color of this DropdownMenuItemContent when not enabled |
selectableItemColors
@Composable
public fun selectableItemColors(
textColor: Color = Color.Unspecified,
containerColor: Color = Color.Unspecified,
leadingIconColor: Color = Color.Unspecified,
trailingContentColor: Color = Color.Unspecified,
disabledTextColor: Color = Color.Unspecified,
disabledContainerColor: Color = Color.Unspecified,
disabledLeadingIconColor: Color = Color.Unspecified,
disabledTrailingContentColor: Color = Color.Unspecified,
selectedTextColor: Color = Color.Unspecified,
selectedContainerColor: Color = Color.Unspecified,
selectedLeadingIconColor: Color = Color.Unspecified,
selectedTrailingContentColor: Color = Color.Unspecified,
): SelectableMenuItemColors
Creates a SelectableMenuItemColors that represents the default text, icon, and container colors used in a standard color variant DropdownMenuItem. This uses the Color.Unspecified to mean “use the value from the source”
Parameters
| textColor | the text color of this DropdownMenuItem when enabled |
| containerColor | the container color of this DropdownMenuItem when enabled and unselected |
| leadingIconColor | the leading icon color of this DropdownMenuItem when enabled |
| trailingContentColor | the trailing content color of this DropdownMenuItem when enabled |
| disabledTextColor | the text color of this DropdownMenuItem when not enabled |
| disabledContainerColor | the container color of this DropdownMenuItem when not enabled. |
| disabledLeadingIconColor | the leading icon color of this DropdownMenuItem when not enabled |
| disabledTrailingContentColor | the trailing content color of this DropdownMenuItem when not enabled |
| selectedContainerColor | the container color of this DropdownMenuItem when enabled and selected |
| selectedTextColor | the text color of this DropdownMenuItem when enabled and selected |
| selectedLeadingIconColor | the leading icon color of this DropdownMenuItem when enabled and selected |
| selectedTrailingContentColor | the trailing content color of this DropdownMenuItem when enabled and selected |
selectableItemColorsLegacy
@Deprecated("Maintained for binary compatibility.", level = DeprecationLevel.HIDDEN)
@Composable
public fun selectableItemColorsLegacy(
textColor: Color = Color.Unspecified,
containerColor: Color = Color.Unspecified,
leadingIconColor: Color = Color.Unspecified,
trailingIconColor: Color = Color.Unspecified,
disabledTextColor: Color = Color.Unspecified,
disabledContainerColor: Color = Color.Unspecified,
disabledLeadingIconColor: Color = Color.Unspecified,
disabledTrailingIconColor: Color = Color.Unspecified,
selectedContainerColor: Color = Color.Unspecified,
selectedTextColor: Color = Color.Unspecified,
selectedLeadingIconColor: Color = Color.Unspecified,
selectedTrailingIconColor: Color = Color.Unspecified,
): MenuItemColors
Creates a MenuItemColors that represents the default text, icon, and container colors used in a standard color variant DropdownMenuItem. This uses the Color.Unspecified to mean “use the value from the source”
Delegates to selectableItemColors to resolve unspecified tokens against MenuTokens (StandardMenuTokens), then adapts the resolved colors into MenuItemColors for binary compatibility.
Parameters
| textColor | the text color of this DropdownMenuItem when enabled |
| containerColor | the container color of this DropdownMenuItem when enabled and unselected |
| leadingIconColor | the leading icon color of this DropdownMenuItem when enabled |
| trailingIconColor | the trailing icon color of this DropdownMenuItem when enabled |
| disabledTextColor | the text color of this DropdownMenuItem when not enabled |
| disabledContainerColor | the container color of this DropdownMenuItem when not enabled |
| disabledLeadingIconColor | the leading icon color of this DropdownMenuItem when not enabled |
| disabledTrailingIconColor | the trailing icon color of this DropdownMenuItem when not enabled |
| selectedContainerColor | the container color of this DropdownMenuItem when enabled and selected |
| selectedTextColor | the text color of this DropdownMenuItem when enabled and selected |
| selectedLeadingIconColor | the leading icon color of this DropdownMenuItem when enabled and selected |
| selectedTrailingIconColor | the trailing icon color of this DropdownMenuItem when enabled and selected |
selectableItemVibrantColors
@Composable
public fun selectableItemVibrantColors(
textColor: Color = Color.Unspecified,
containerColor: Color = Color.Unspecified,
leadingIconColor: Color = Color.Unspecified,
trailingContentColor: Color = Color.Unspecified,
disabledTextColor: Color = Color.Unspecified,
disabledContainerColor: Color = Color.Unspecified,
disabledLeadingIconColor: Color = Color.Unspecified,
disabledTrailingContentColor: Color = Color.Unspecified,
selectedTextColor: Color = Color.Unspecified,
selectedContainerColor: Color = Color.Unspecified,
selectedLeadingIconColor: Color = Color.Unspecified,
selectedTrailingContentColor: Color = Color.Unspecified,
): SelectableMenuItemColors
Creates a SelectableMenuItemColors that represents the default text, icon, and container colors used in a vibrant color variant DropdownMenuItem. This uses the Color.Unspecified to mean “use the value from the source”
Parameters
| textColor | the text color of this DropdownMenuItem when enabled |
| containerColor | the container color of this DropdownMenuItem when enabled and unselected |
| leadingIconColor | the leading icon color of this DropdownMenuItem when enabled |
| trailingContentColor | the trailing content color of this DropdownMenuItem when enabled |
| disabledTextColor | the text color of this DropdownMenuItem when not enabled |
| disabledContainerColor | the container color of this DropdownMenuItem when not enabled. |
| disabledLeadingIconColor | the leading icon color of this DropdownMenuItem when not enabled |
| disabledTrailingContentColor | the trailing content color of this DropdownMenuItem when not enabled |
| selectedContainerColor | the container color of this DropdownMenuItem when enabled and selected |
| selectedTextColor | the text color of this DropdownMenuItem when enabled and selected |
| selectedLeadingIconColor | the leading icon color of this DropdownMenuItem when enabled and selected |
| selectedTrailingContentColor | the trailing content color of this DropdownMenuItem when enabled and selected |
selectableItemVibrantColorsLegacy
@Deprecated("Maintained for binary compatibility.", level = DeprecationLevel.HIDDEN)
@Composable
public fun selectableItemVibrantColorsLegacy(
textColor: Color = Color.Unspecified,
containerColor: Color = Color.Unspecified,
leadingIconColor: Color = Color.Unspecified,
trailingIconColor: Color = Color.Unspecified,
disabledTextColor: Color = Color.Unspecified,
disabledContainerColor: Color = Color.Unspecified,
disabledLeadingIconColor: Color = Color.Unspecified,
disabledTrailingIconColor: Color = Color.Unspecified,
selectedContainerColor: Color = Color.Unspecified,
selectedTextColor: Color = Color.Unspecified,
selectedLeadingIconColor: Color = Color.Unspecified,
selectedTrailingIconColor: Color = Color.Unspecified,
): MenuItemColors
Creates a MenuItemColors that represents the default text, icon, and container colors used in a vibrant color variant DropdownMenuItem. This uses the Color.Unspecified to mean “use the value from the source”
Parameters
| textColor | the text color of this DropdownMenuItem when enabled |
| containerColor | the container color of this DropdownMenuItem when enabled and unselected |
| leadingIconColor | the leading icon color of this DropdownMenuItem when enabled |
| trailingIconColor | the trailing icon color of this DropdownMenuItem when enabled |
| disabledTextColor | the text color of this DropdownMenuItem when not enabled |
| disabledContainerColor | the container color of this DropdownMenuItem when not enabled |
| disabledLeadingIconColor | the leading icon color of this DropdownMenuItem when not enabled |
| disabledTrailingIconColor | the trailing icon color of this DropdownMenuItem when not enabled |
| selectedContainerColor | the container color of this DropdownMenuItem when enabled and selected |
| selectedTextColor | the text color of this DropdownMenuItem when enabled and selected |
| selectedLeadingIconColor | the leading icon color of this DropdownMenuItem when enabled and selected |
| selectedTrailingIconColor | the trailing icon color of this DropdownMenuItem when enabled and selected |
rememberDropdownMenuPopupPositionProvider
@Composable
public fun rememberDropdownMenuPopupPositionProvider(
dropdownMenuAnchorPosition: MenuAnchorPosition,
offset: DpOffset = DpOffset(0.dp, 0.dp),
): DropdownMenuPopupPositionProvider
Creates and remembers a DropdownMenuPopupPositionProvider that positions a dropdown menu relative to its anchor.
Parameters
| dropdownMenuAnchorPosition | The positioning strategy to use. This determines the preferred alignment of the menu relative to the anchor. There are predefined positions, please see MenuAnchorPosition.Above, MenuAnchorPosition.Below, MenuAnchorPosition.Left, MenuAnchorPosition.Right, MenuAnchorPosition.Start, and MenuAnchorPosition.End. A custom positioning can also be defined through the use of MenuAnchorPosition.Custom. |
| offset | An optional DpOffset to apply to the final calculated position. |