public object IconButtonDefaults
Contains the default values used by IconButton.
Properties
shape
public val shape: RoundedCornerShape
Recommended Shape for IconButton.
pressedShape
public val pressedShape: CornerBasedShape
Recommended pressed Shape for IconButton.
minimumVerticalListContentPadding
public val minimumVerticalListContentPadding: Dp
The minimum vertical content padding for the list when an IconButton is placed at the top or bottom edge. Recommended for use with androidx.wear.compose.foundation.lazy.TransformingLazyColumnItemScope's androidx.wear.compose.foundation.lazy.TransformingLazyColumnItemScope.minimumVerticalContentPadding, which allows items to choose a preferred content padding for the list. TransformingLazyColumn takes its contentPadding as the maximum of the preferred content padding values and its own contentPadding parameter.
DisabledImageOpacity
public val DisabledImageOpacity: Float
Recommended alpha to apply to an IconButton with Image content with disabled
SmallIconSize
public val SmallIconSize: Dp
The recommended size of an icon when used inside an icon button with size SmallButtonSize or ExtraSmallButtonSize. Use iconSizeFor to easily determine the icon size.
DefaultIconSize
public val DefaultIconSize: Dp
The default size of an icon when used inside an icon button of size DefaultButtonSize. Use iconSizeFor to easily determine the icon size.
LargeIconSize
public val LargeIconSize: Dp
The size of an icon when used inside an icon button with size LargeButtonSize. Use iconSizeFor to easily determine the icon size.
ExtraSmallButtonSize
public val ExtraSmallButtonSize: Dp
The recommended background size of an extra small, compact button. It is recommended to apply this size using Modifier.touchTargetAwareSize.
SmallButtonSize
public val SmallButtonSize: Dp
The recommended size for a small button. It is recommended to apply this size using Modifier.touchTargetAwareSize.
DefaultButtonSize
public val DefaultButtonSize: Dp
The default size applied for buttons. It is recommended to apply this size using Modifier.touchTargetAwareSize.
LargeButtonSize
public val LargeButtonSize: Dp
The recommended size for a large button. It is recommended to apply this size using Modifier.touchTargetAwareSize.
Functions
shapes
@Composable public fun shapes(): IconButtonShapes
Returns the default IconButtonShapes for a static IconButton.
shapes
@Composable
public fun shapes(shape: Shape): IconButtonShapes
Returns a IconButtonShapes for a static IconButton.
Parameters
| shape | The normal shape of the IconButton. |
animatedShapes
@Composable
public fun animatedShapes(): IconButtonShapes
Returns the default IconButtonShapes with a animation between two CornerBasedShapes when pressed.
Example of a simple icon button using the default colors, animated when pressed:
Example of a simple icon toggle button using the default colors, animated when pressed:
animatedShapes
@Composable
public fun animatedShapes(
shape: CornerBasedShape? = null,
pressedShape: CornerBasedShape? = null,
): IconButtonShapes
Returns a IconButtonShapes with an animation between two CornerBasedShapes when pressed.
Example of a simple icon button using the default colors, animated when pressed:
Parameters
| shape | The normal shape of the IconButton - if null, the default IconButtonDefaults.shape is used. |
| pressedShape | The pressed shape of the IconButton - if null, the default IconButtonDefaults.pressedShape is used. |
iconSizeFor
public fun iconSizeFor(buttonSize: Dp): Dp
Recommended icon size for a given icon button size.
Ensures that the minimum recommended icon size is applied.
Examples: for size LargeButtonSize, returns LargeIconSize, for size ExtraSmallButtonSize returns SmallIconSize.
Parameters
| buttonSize | The size of the icon button |
filledIconButtonColors
@Composable
public fun filledIconButtonColors(): IconButtonColors
Returns an IconButtonColors with the colors for FilledIconButton - by default, a colored background with a contrasting icon color. If the icon button is disabled then the colors will default to the MaterialTheme onSurface color with suitable alpha values applied.
filledIconButtonColors
@Composable
public fun filledIconButtonColors(
containerColor: Color = Color.Unspecified,
contentColor: Color = Color.Unspecified,
disabledContainerColor: Color = Color.Unspecified,
disabledContentColor: Color = Color.Unspecified,
): IconButtonColors
Returns an IconButtonColors with the colors for FilledIconButton - by default, a colored background with a contrasting icon color. If the icon button is disabled then the colors will default to the MaterialTheme onSurface color with suitable alpha values applied.
Parameters
| containerColor | The background color of this icon button when enabled. |
| contentColor | The color of this icon when enabled. |
| disabledContainerColor | The background color of this icon button when not enabled. |
| disabledContentColor | The color of this icon when not enabled. |
filledVariantIconButtonColors
@Composable
public fun filledVariantIconButtonColors(): IconButtonColors
Returns an IconButtonColors as an alternative to the filledTonalIconButtonColors, giving a surface with more chroma to indicate selected or highlighted states that are not primary calls-to-action. If the icon button is disabled then the colors will default to the MaterialTheme onSurface color with suitable alpha values applied.
Example of creating a FilledIconButton with filledVariantIconButtonColors:
filledVariantIconButtonColors
@Composable
public fun filledVariantIconButtonColors(
containerColor: Color = Color.Unspecified,
contentColor: Color = Color.Unspecified,
disabledContainerColor: Color = Color.Unspecified,
disabledContentColor: Color = Color.Unspecified,
): IconButtonColors
Returns an IconButtonColors as an alternative to the filledTonalIconButtonColors, giving a surface with more chroma to indicate selected or highlighted states that are not primary calls-to-action. If the icon button is disabled then the colors will default to the MaterialTheme onSurface color with suitable alpha values applied.
Example of creating a FilledIconButton with filledVariantIconButtonColors:
Parameters
| containerColor | The background color of this icon button when enabled. |
| contentColor | The color of this icon when enabled. |
| disabledContainerColor | The background color of this icon button when not enabled. |
| disabledContentColor | The color of this icon when not enabled. |
filledTonalIconButtonColors
@Composable
public fun filledTonalIconButtonColors(): IconButtonColors
Returns an IconButtonColors with the colors for FilledTonalIconButton- by default, a muted colored background with a contrasting icon color. If the icon button is disabled then the colors will default to the MaterialTheme onSurface color with suitable alpha values applied.
filledTonalIconButtonColors
@Composable
public fun filledTonalIconButtonColors(
containerColor: Color = Color.Unspecified,
contentColor: Color = Color.Unspecified,
disabledContainerColor: Color = Color.Unspecified,
disabledContentColor: Color = Color.Unspecified,
): IconButtonColors
Returns an IconButtonColors with the colors for FilledTonalIconButton- by default, a muted colored background with a contrasting icon color. If the icon button is disabled then the colors will default to the MaterialTheme onSurface color with suitable alpha values applied.
Parameters
| containerColor | The background color of this icon button when enabled. |
| contentColor | The color of this icon when enabled. |
| disabledContainerColor | The background color of this icon button when not enabled. |
| disabledContentColor | The color of this icon when not enabled. |
outlinedIconButtonColors
@Composable
public fun outlinedIconButtonColors(): IconButtonColors
Returns an IconButtonColors with the colors for OutlinedIconButton- by default, a transparent background with contrasting icon color. If the icon button is disabled then the colors will default to the MaterialTheme onSurface color with suitable alpha values applied.
outlinedIconButtonColors
@Composable
public fun outlinedIconButtonColors(
contentColor: Color = Color.Unspecified,
disabledContentColor: Color = Color.Unspecified,
): IconButtonColors
Returns an IconButtonColors with the colors for OutlinedIconButton- by default, a transparent background with contrasting icon color. If the icon button is disabled then the colors will default to the MaterialTheme onSurface color with suitable alpha values applied.
Parameters
| contentColor | The color of this icon button when enabled. |
| disabledContentColor | The color of this icon when not enabled. |
iconButtonColors
@Composable
public fun iconButtonColors(): IconButtonColors
Returns an IconButtonColors with the colors for IconButton - by default, a transparent background with a contrasting icon color. If the icon button is disabled then the colors will default to the MaterialTheme onSurface color with suitable alpha values applied.
iconButtonColors
@Composable
public fun iconButtonColors(
containerColor: Color = Color.Transparent,
contentColor: Color = Color.Unspecified,
disabledContainerColor: Color = Color.Transparent,
disabledContentColor: Color = Color.Unspecified,
): IconButtonColors
Returns an IconButtonColors with the colors for IconButton - by default, a transparent background with a contrasting icon color. If the icon button is disabled then the colors will default to the MaterialTheme onSurface color with suitable alpha values applied.
Parameters
| containerColor | The background color of this icon button when enabled. |
| contentColor | The color of this icon when enabled. |
| disabledContainerColor | The background color of this icon button when not enabled. |
| disabledContentColor | The color of this icon when not enabled. |