Object

IconButtonDefaults

Contains the default values used by IconButton.

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Android
public object IconButtonDefaults

Contains the default values used by IconButton.

Functions

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