MenuDefaults
-
Cmn
object MenuDefaults
Contains default values used for DropdownMenu and DropdownMenuItem.
Summary
Public functions |
||
|---|---|---|
Unit |
@ComposableThe default label recommended to be used within a |
Cmn
|
Unit |
@ComposableThe default trailing label recommended to be used within a |
Cmn
|
MenuGroupShapes |
@ComposableA |
Cmn
|
MenuGroupShapes |
Creates a |
Cmn
|
MenuGroupShapes |
@ComposableCreates a |
Cmn
|
MenuItemColors |
Creates a |
Cmn
|
MenuItemColors |
@ComposableCreates a |
Cmn
|
MenuItemShapes |
@ComposableA |
Cmn
|
MenuItemShapes |
Creates a |
Cmn
|
MenuItemShapes |
@ComposableCreates a |
Cmn
|
DropdownMenuPopupPositionProvider |
@ComposableCreates and remembers a |
Cmn
|
MenuItemColors |
@ComposableCreates a |
Cmn
|
MenuItemColors |
@ComposableCreates a |
Cmn
|
Public properties |
||
|---|---|---|
PopupProperties |
The default |
Cmn
|
PaddingValues |
Default padding used for |
Cmn
|
PaddingValues |
The default horizontal padding for a menu group label. |
Cmn
|
PaddingValues |
Default padding used for |
Cmn
|
Arrangement.Horizontal |
Default horizontal arrangement for a menu item. |
Cmn
|
PaddingValues |
The default horizontal padding for a menu group trailing label. |
Cmn
|
PaddingValues |
Default padding used for |
Cmn
|
Dp |
The default spacing between each menu group. |
Cmn
|
PaddingValues |
The default padding for a |
Cmn
|
Dp |
The default leading icon size for a menu item. |
Cmn
|
Dp |
The default shadow elevation for a menu. |
Cmn
|
Dp |
The default tonal elevation for a menu. |
Cmn
|
Dp |
The default trailing icon size for a menu item. |
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
DropdownMenuGroupLabel
@Composable
fun DropdownMenuGroupLabel(
modifier: Modifier = Modifier,
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 | |
|---|---|
modifier: Modifier = Modifier |
the |
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. |
DropdownMenuItemTrailingLabel
@Composable
fun DropdownMenuItemTrailingLabel(
modifier: Modifier = Modifier,
padding: PaddingValues = DropdownMenuItemTrailingLabelHorizontalPadding,
content: @Composable () -> Unit
): Unit
The default trailing label recommended to be used within a DropdownMenuItem which can be passed to its trailingIcon param.
| Parameters | |
|---|---|
modifier: Modifier = Modifier |
the |
padding: PaddingValues = DropdownMenuItemTrailingLabelHorizontalPadding |
the padding applied to the label's content. |
content: @Composable () -> Unit |
the content of the label. |
groupShape
@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.
groupShapes
@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
@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 |
inactiveShape: Shape? = null |
the shape when no longer being hovered. It uses |
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,
trailingContentColor: Color = Color.Unspecified,
disabledTextColor: Color = Color.Unspecified,
disabledLeadingIconColor: Color = Color.Unspecified,
disabledTrailingContentColor: 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 |
leadingIconColor: Color = Color.Unspecified |
the leading icon color of this |
trailingContentColor: Color = Color.Unspecified |
the trailing content color of this |
disabledTextColor: Color = Color.Unspecified |
the text color of this |
disabledLeadingIconColor: Color = Color.Unspecified |
the leading icon color of this |
disabledTrailingContentColor: Color = Color.Unspecified |
the trailing content color of this |
itemShape
@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.
itemShapes
@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
@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 |
selectedShape: Shape? = null |
the shape when selected. It uses |
rememberDropdownMenuPopupPositionProvider
@Composable
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: MenuAnchorPosition |
The positioning strategy to use. This determines the preferred alignment of the menu relative to the anchor. There are predefined positions, please see |
offset: DpOffset = DpOffset(0.dp, 0.dp) |
An optional |
selectableItemColors
@Composable
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
): 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”
| Parameters | |
|---|---|
textColor: Color = Color.Unspecified |
the text color of this |
containerColor: Color = Color.Unspecified |
the container color of this |
leadingIconColor: Color = Color.Unspecified |
the leading icon color of this |
trailingContentColor: Color = Color.Unspecified |
the trailing content color of this |
disabledTextColor: Color = Color.Unspecified |
the text color of this |
disabledContainerColor: Color = Color.Unspecified |
the container color of this |
disabledLeadingIconColor: Color = Color.Unspecified |
the leading icon color of this |
disabledTrailingContentColor: Color = Color.Unspecified |
the trailing content color of this |
selectedTextColor: Color = Color.Unspecified |
the text color of this |
selectedContainerColor: Color = Color.Unspecified |
the container color of this |
selectedLeadingIconColor: Color = Color.Unspecified |
the leading icon color of this |
selectedTrailingContentColor: Color = Color.Unspecified |
the trailing content color of this |
selectableItemVibrantColors
@Composable
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
): 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: Color = Color.Unspecified |
the text color of this |
containerColor: Color = Color.Unspecified |
the container color of this |
leadingIconColor: Color = Color.Unspecified |
the leading icon color of this |
trailingContentColor: Color = Color.Unspecified |
the trailing content color of this |
disabledTextColor: Color = Color.Unspecified |
the text color of this |
disabledContainerColor: Color = Color.Unspecified |
the container color of this |
disabledLeadingIconColor: Color = Color.Unspecified |
the leading icon color of this |
disabledTrailingContentColor: Color = Color.Unspecified |
the trailing content color of this |
selectedTextColor: Color = Color.Unspecified |
the text color of this |
selectedContainerColor: Color = Color.Unspecified |
the container color of this |
selectedLeadingIconColor: Color = Color.Unspecified |
the leading icon color of this |
selectedTrailingContentColor: Color = Color.Unspecified |
the trailing content color of this |
Public properties
DefaultMenuProperties
val DefaultMenuProperties: PopupProperties
The default PopupProperties used in DropdownMenu and DropdownMenuPopup
DropdownMenuGroupContentPadding
val DropdownMenuGroupContentPadding: PaddingValues
Default padding used for DropdownMenuGroup.
DropdownMenuGroupLabelHorizontalPadding
val DropdownMenuGroupLabelHorizontalPadding: PaddingValues
The default horizontal padding for a menu group label. Please see MenuDefaults.DropdownMenuGroupLabel.
DropdownMenuItemContentPadding
val DropdownMenuItemContentPadding: PaddingValues
Default padding used for DropdownMenuItem.
DropdownMenuItemHorizontalArrangement
val DropdownMenuItemHorizontalArrangement: Arrangement.Horizontal
Default horizontal arrangement for a menu item.
DropdownMenuItemTrailingLabelHorizontalPadding
val DropdownMenuItemTrailingLabelHorizontalPadding: PaddingValues
The default horizontal padding for a menu group trailing label. Please see MenuDefaults.DropdownMenuItemTrailingLabel.
DropdownMenuSelectableItemContentPadding
val DropdownMenuSelectableItemContentPadding: PaddingValues
Default padding used for DropdownMenuItem that are selectable.
GroupSpacing
val GroupSpacing: Dp
The default spacing between each menu group. Usually used in a Spacer's height
HorizontalDividerPadding
val HorizontalDividerPadding: PaddingValues
The default padding for a HorizontalDivider used in a menu group. Use this padding value in a HorizontalDivider's padding modifier.
groupStandardContainerColor
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
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.
inactiveGroupShape
val inactiveGroupShape: Shape
The shape for a group of a menu that is no longer being hovered.
leadingItemShape
val leadingItemShape: Shape
The default shape for the leading item of a menu or group.
middleItemShape
val middleItemShape: Shape
The default shape for the middle item of a menu or group.
standaloneGroupShape
val standaloneGroupShape: Shape
The default shape for a standalone group of a menu.
standaloneItemShape
val standaloneItemShape: Shape
The default shape for a standalone item of a menu or group.
trailingGroupShape
val trailingGroupShape: Shape
The default shape for the trailing group of a menu.
trailingItemShape
val trailingItemShape: Shape
The default shape for the trailing item of a menu or group.