MenuDefaults


Contains default values used for DropdownMenu and DropdownMenuItem.

Summary

Public functions

Unit
@ExperimentalMaterial3ExpressiveApi
@Composable
Label(
    contentAlignment: Alignment,
    padding: PaddingValues,
    content: @Composable () -> Unit
)

The default label recommended to be used within a DropdownMenuGroup.

Cmn
Unit
@ExperimentalMaterial3ExpressiveApi
@Composable
LabelWithSupportingText(
    supportingText: @Composable () -> Unit,
    content: @Composable () -> Unit
)

Column of a label and its supporting text.

Cmn
MenuGroupShapes

A MenuGroupShapes constructor that the group in index should have when there are count groups in the menu.

Cmn
MenuGroupShapes

Creates a MenuGroupShapes that represents the default shapes used in a DropdownMenuGroup.

Cmn
MenuGroupShapes

Creates a MenuGroupShapes that represents the default shapes used in a DropdownMenuGroup, allowing for overrides.

Cmn
MenuItemColors

Creates a MenuItemColors that represents the default text and icon colors used in a DropdownMenuItemContent.

Cmn
MenuItemColors
@Composable
itemColors(
    textColor: Color,
    leadingIconColor: Color,
    trailingIconColor: Color,
    disabledTextColor: Color,
    disabledLeadingIconColor: Color,
    disabledTrailingIconColor: Color
)

Creates a MenuItemColors that represents the default text and icon colors used in a DropdownMenuItemContent.

Cmn
MenuItemShapes

A MenuItemShapes constructor that the item in index should have when there are count items in the menu or group.

Cmn
MenuItemShapes

Creates a MenuItemShapes that represents the shapes used in a toggleable or selectable DropdownMenuItem.

Cmn
MenuItemShapes

Creates a MenuItemShapes that represents the shapes used in a toggleable or selectable DropdownMenuItem, allowing for overrides.

Cmn
MenuItemColors
@ExperimentalMaterial3ExpressiveApi
@Composable
selectableItemColors(
    textColor: Color,
    containerColor: Color,
    leadingIconColor: Color,
    trailingIconColor: Color,
    disabledTextColor: Color,
    disabledLeadingIconColor: Color,
    disabledTrailingIconColor: Color,
    selectedContainerColor: Color,
    selectedTextColor: Color,
    selectedLeadingIconColor: Color,
    selectedTrailingIconColor: Color
)

Creates a MenuItemColors that represents the default text, icon, and container colors used in a standard color variant DropdownMenuItem.

Cmn
MenuItemColors
@ExperimentalMaterial3ExpressiveApi
@Composable
selectableItemVibrantColors(
    textColor: Color,
    containerColor: Color,
    leadingIconColor: Color,
    trailingIconColor: Color,
    disabledTextColor: Color,
    disabledLeadingIconColor: Color,
    disabledTrailingIconColor: Color,
    selectedContainerColor: Color,
    selectedTextColor: Color,
    selectedLeadingIconColor: Color,
    selectedTrailingIconColor: Color
)

Creates a MenuItemColors that represents the default text, icon, and container colors used in a vibrant color variant DropdownMenuItem.

Cmn

Public properties

PaddingValues

Default padding used for DropdownMenuGroup.

Cmn
PaddingValues

The default horizontal padding for a menu group label.

Cmn
PaddingValues

Default padding used for DropdownMenuItem.

Cmn
Dp

The default spacing between each menu group.

Cmn
Dp

The default horizontal padding for a divider used in a menu group.

Cmn
Dp

The default shadow elevation for a menu.

Cmn
Dp

The default tonal elevation for a menu.

Cmn
Color

The default container color for a menu.

Cmn
Color

The standard default container color for a group within a menu.

Cmn
Color

The vibrant default container color for a group within a menu.

Cmn
Shape

The shape for a group of a menu that is no longer being hovered.

Cmn
Shape

The default shape for the leading group of a menu.

Cmn
Shape

The default shape for the leading item of a menu or group.

Cmn
Shape

The default shape for the middle group of a menu.

Cmn
Shape

The default shape for the middle item of a menu or group.

Cmn
Shape

The selected shape for items of a group.

Cmn
Shape

The default shape for a menu.

Cmn
Shape

The default shape for a standalone group of a menu.

Cmn
Shape

The default shape for a standalone item of a menu or group.

Cmn
Shape

The default shape for the trailing group of a menu.

Cmn
Shape

The default shape for the trailing item of a menu or group.

Cmn

Public functions

Label

@ExperimentalMaterial3ExpressiveApi
@Composable
fun Label(
    contentAlignment: Alignment = Alignment.CenterStart,
    padding: PaddingValues = DropdownMenuGroupLabelHorizontalPadding,
    content: @Composable () -> Unit
): 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
contentAlignment: Alignment = Alignment.CenterStart

the alignment of the label's content.

padding: PaddingValues = DropdownMenuGroupLabelHorizontalPadding

the padding applied to the label's content.

content: @Composable () -> Unit

the content of the label.

LabelWithSupportingText

@ExperimentalMaterial3ExpressiveApi
@Composable
fun LabelWithSupportingText(
    supportingText: @Composable () -> Unit,
    content: @Composable () -> Unit
): Unit

Column of a label and its supporting text. Used in a DropdownMenuItem's text parameter when a supporting text is desired.

Parameters
supportingText: @Composable () -> Unit

the supporting text of the label.

content: @Composable () -> Unit

the content of the label.

groupShape

@ExperimentalMaterial3ExpressiveApi
@Composable
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: Int

the index for this group in the menu.

count: Int

the count of groups in this menu.

groupShapes

@ExperimentalMaterial3ExpressiveApi
@Composable
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.

groupShapes

@ExperimentalMaterial3ExpressiveApi
@Composable
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: Shape? = null

the default shape of the group. It uses standaloneGroupShape as the default if null is provided.

inactiveShape: Shape? = null

the shape when no longer being hovered. It uses inactiveGroupShape as the default if null is provided.

itemColors

@Composable
fun itemColors(): MenuItemColors

Creates a MenuItemColors that represents the default text and icon colors used in a DropdownMenuItemContent.

itemColors

@Composable
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: Color = Color.Unspecified

the text color of this DropdownMenuItemContent when enabled

leadingIconColor: Color = Color.Unspecified

the leading icon color of this DropdownMenuItemContent when enabled

trailingIconColor: Color = Color.Unspecified

the trailing icon color of this DropdownMenuItemContent when enabled

disabledTextColor: Color = Color.Unspecified

the text color of this DropdownMenuItemContent when not enabled

disabledLeadingIconColor: Color = Color.Unspecified

the leading icon color of this DropdownMenuItemContent when not enabled

disabledTrailingIconColor: Color = Color.Unspecified

the trailing icon color of this DropdownMenuItemContent when not enabled

itemShape

@ExperimentalMaterial3ExpressiveApi
@Composable
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: Int

the index for this item in the menu or group.

count: Int

the count of items in this menu or group.

itemShapes

@ExperimentalMaterial3ExpressiveApi
@Composable
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.

itemShapes

@ExperimentalMaterial3ExpressiveApi
@Composable
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: Shape? = null

the shape when unselected. It uses middleItemShape as the default if null is provided.

selectedShape: Shape? = null

the shape when selected. It uses selectedItemShape as the default if null is provided.

selectableItemColors

@ExperimentalMaterial3ExpressiveApi
@Composable
fun selectableItemColors(
    textColor: Color = Color.Unspecified,
    containerColor: Color = Color.Unspecified,
    leadingIconColor: Color = Color.Unspecified,
    trailingIconColor: Color = Color.Unspecified,
    disabledTextColor: 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.

Parameters
textColor: Color = Color.Unspecified

the text color of this DropdownMenuItem when enabled

containerColor: Color = Color.Unspecified

the container color of this DropdownMenuItem when enabled and unselected

leadingIconColor: Color = Color.Unspecified

the leading icon color of this DropdownMenuItem when enabled

trailingIconColor: Color = Color.Unspecified

the trailing icon color of this DropdownMenuItem when enabled

disabledTextColor: Color = Color.Unspecified

the text color of this DropdownMenuItem when not enabled

disabledLeadingIconColor: Color = Color.Unspecified

the leading icon color of this DropdownMenuItem when not enabled

disabledTrailingIconColor: Color = Color.Unspecified

the trailing icon color of this DropdownMenuItem when not enabled

selectedContainerColor: Color = Color.Unspecified

the container color of this DropdownMenuItem when enabled and selected

selectedTextColor: Color = Color.Unspecified

the text color of this DropdownMenuItem when enabled and selected

selectedLeadingIconColor: Color = Color.Unspecified

the leading icon color of this DropdownMenuItem when enabled and selected

selectedTrailingIconColor: Color = Color.Unspecified

the trailing icon color of this DropdownMenuItem when enabled and selected

selectableItemVibrantColors

@ExperimentalMaterial3ExpressiveApi
@Composable
fun selectableItemVibrantColors(
    textColor: Color = Color.Unspecified,
    containerColor: Color = Color.Unspecified,
    leadingIconColor: Color = Color.Unspecified,
    trailingIconColor: Color = Color.Unspecified,
    disabledTextColor: 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.

Parameters
textColor: Color = Color.Unspecified

the text color of this DropdownMenuItem when enabled

containerColor: Color = Color.Unspecified

the container color of this DropdownMenuItem when enabled and unselected

leadingIconColor: Color = Color.Unspecified

the leading icon color of this DropdownMenuItem when enabled

trailingIconColor: Color = Color.Unspecified

the trailing icon color of this DropdownMenuItem when enabled

disabledTextColor: Color = Color.Unspecified

the text color of this DropdownMenuItem when not enabled

disabledLeadingIconColor: Color = Color.Unspecified

the leading icon color of this DropdownMenuItem when not enabled

disabledTrailingIconColor: Color = Color.Unspecified

the trailing icon color of this DropdownMenuItem when not enabled

selectedContainerColor: Color = Color.Unspecified

the container color of this DropdownMenuItem when enabled and selected

selectedTextColor: Color = Color.Unspecified

the text color of this DropdownMenuItem when enabled and selected

selectedLeadingIconColor: Color = Color.Unspecified

the leading icon color of this DropdownMenuItem when enabled and selected

selectedTrailingIconColor: Color = Color.Unspecified

the trailing icon color of this DropdownMenuItem when enabled and selected

Public properties

val DropdownMenuGroupContentPaddingPaddingValues

Default padding used for DropdownMenuGroup.

@ExperimentalMaterial3ExpressiveApi
val DropdownMenuGroupLabelHorizontalPaddingPaddingValues

The default horizontal padding for a menu group label. Please see MenuDefaults.Label.

val DropdownMenuItemContentPaddingPaddingValues

Default padding used for DropdownMenuItem.

GroupSpacing

@ExperimentalMaterial3ExpressiveApi
val GroupSpacingDp

The default spacing between each menu group. Usually used in a Spacer's height

HorizontalDividerPadding

@ExperimentalMaterial3ExpressiveApi
val HorizontalDividerPaddingDp

The default horizontal padding for a divider used in a menu group. Usually used in a HorizontalDivider's horizontal padding

ShadowElevation

val ShadowElevationDp

The default shadow elevation for a menu.

TonalElevation

val TonalElevationDp

The default tonal elevation for a menu.

containerColor

val containerColorColor

The default container color for a menu.

groupStandardContainerColor

@ExperimentalMaterial3ExpressiveApi
val groupStandardContainerColorColor

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

@ExperimentalMaterial3ExpressiveApi
val groupVibrantContainerColorColor

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.

inactiveGroupShape

@ExperimentalMaterial3ExpressiveApi
val inactiveGroupShapeShape

The shape for a group of a menu that is no longer being hovered.

leadingGroupShape

@ExperimentalMaterial3ExpressiveApi
val leadingGroupShapeShape

The default shape for the leading group of a menu.

leadingItemShape

@ExperimentalMaterial3ExpressiveApi
val leadingItemShapeShape

The default shape for the leading item of a menu or group.

middleGroupShape

@ExperimentalMaterial3ExpressiveApi
val middleGroupShapeShape

The default shape for the middle group of a menu.

middleItemShape

@ExperimentalMaterial3ExpressiveApi
val middleItemShapeShape

The default shape for the middle item of a menu or group.

selectedItemShape

@ExperimentalMaterial3ExpressiveApi
val selectedItemShapeShape

The selected shape for items of a group.

shape

val shapeShape

The default shape for a menu.

standaloneGroupShape

@ExperimentalMaterial3ExpressiveApi
val standaloneGroupShapeShape

The default shape for a standalone group of a menu.

standaloneItemShape

@ExperimentalMaterial3ExpressiveApi
val standaloneItemShapeShape

The default shape for a standalone item of a menu or group.

trailingGroupShape

@ExperimentalMaterial3ExpressiveApi
val trailingGroupShapeShape

The default shape for the trailing group of a menu.

trailingItemShape

@ExperimentalMaterial3ExpressiveApi
val trailingItemShapeShape

The default shape for the trailing item of a menu or group.