IconButtonDefaults


object IconButtonDefaults


Contains the default values used by IconButton.

Summary

Public functions

IconButtonColors

Creates a ButtonColors with the colors for FilledIconButton - by default, a colored background with a contrasting icon color.

IconButtonColors
@Composable
filledIconButtonColors(
    containerColor: Color,
    contentColor: Color,
    disabledContainerColor: Color,
    disabledContentColor: Color
)

Creates a ButtonColors with the colors for FilledIconButton - by default, a colored background with a contrasting icon color.

IconButtonColors

Creates a ButtonColors with the colors for FilledTonalIconButton- by default, a muted colored background with a contrasting icon color.

IconButtonColors
@Composable
filledTonalIconButtonColors(
    containerColor: Color,
    contentColor: Color,
    disabledContainerColor: Color,
    disabledContentColor: Color
)

Creates a ButtonColors with the colors for FilledTonalIconButton- by default, a muted colored background with a contrasting icon color.

IconButtonColors

Creates a ButtonColors with the colors for IconButton - by default, a transparent background with a contrasting icon color.

IconButtonColors
@Composable
iconButtonColors(
    containerColor: Color,
    contentColor: Color,
    disabledContainerColor: Color,
    disabledContentColor: Color
)

Creates a ButtonColors with the colors for IconButton - by default, a transparent background with a contrasting icon color.

Dp
iconSizeFor(size: Dp)

Recommended icon size for a given icon button size.

ToggleButtonColors
@Composable
iconToggleButtonColors(
    checkedContainerColor: Color,
    checkedContentColor: Color,
    uncheckedContainerColor: Color,
    uncheckedContentColor: Color,
    disabledCheckedContainerColor: Color,
    disabledCheckedContentColor: Color,
    disabledUncheckedContainerColor: Color,
    disabledUncheckedContentColor: Color
)

Creates a ToggleButtonColors for a IconToggleButton

IconButtonColors

Creates a ButtonColors with the colors for OutlinedIconButton- by default, a transparent background with contrasting icon color.

IconButtonColors
@Composable
outlinedIconButtonColors(
    contentColor: Color,
    disabledContentColor: Color
)

Creates a ButtonColors with the colors for OutlinedIconButton- by default, a transparent background with contrasting icon color.

Public properties

Dp

The default size applied for buttons.

Dp

The default size of an icon when used inside an icon button of size DefaultButtonSize.

Dp

The recommended background size of an extra small, compact button.

Dp

The recommended size for a large button.

Dp

The size of an icon when used inside an icon button with size LargeButtonSize.

Dp

The recommended size for a small button.

Dp

The recommended size of an icon when used inside an icon button with size SmallButtonSize or ExtraSmallButtonSize.

Shape

Recommended Shape for IconButton.

Public functions

filledIconButtonColors

Added in 1.0.0-alpha21
@Composable
fun filledIconButtonColors(): IconButtonColors

Creates a ButtonColors 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
fun filledIconButtonColors(
    containerColor: Color = Color.Unspecified,
    contentColor: Color = Color.Unspecified,
    disabledContainerColor: Color = Color.Unspecified,
    disabledContentColor: Color = Color.Unspecified
): IconButtonColors

Creates a ButtonColors 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: Color = Color.Unspecified

The background color of this icon button when enabled.

contentColor: Color = Color.Unspecified

The color of this icon when enabled.

disabledContainerColor: Color = Color.Unspecified

The background color of this icon button when not enabled.

disabledContentColor: Color = Color.Unspecified

The color of this icon when not enabled.

filledTonalIconButtonColors

Added in 1.0.0-alpha21
@Composable
fun filledTonalIconButtonColors(): IconButtonColors

Creates a ButtonColors 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
fun filledTonalIconButtonColors(
    containerColor: Color = Color.Unspecified,
    contentColor: Color = Color.Unspecified,
    disabledContainerColor: Color = Color.Unspecified,
    disabledContentColor: Color = Color.Unspecified
): IconButtonColors

Creates a ButtonColors 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: Color = Color.Unspecified

The background color of this icon button when enabled.

contentColor: Color = Color.Unspecified

The color of this icon when enabled.

disabledContainerColor: Color = Color.Unspecified

The background color of this icon button when not enabled.

disabledContentColor: Color = Color.Unspecified

The color of this icon when not enabled.

iconButtonColors

Added in 1.0.0-alpha21
@Composable
fun iconButtonColors(): IconButtonColors

Creates a ButtonColors 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
fun iconButtonColors(
    containerColor: Color = Color.Transparent,
    contentColor: Color = Color.Unspecified,
    disabledContainerColor: Color = Color.Transparent,
    disabledContentColor: Color = Color.Unspecified
): IconButtonColors

Creates a ButtonColors 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: Color = Color.Transparent

The background color of this icon button when enabled.

contentColor: Color = Color.Unspecified

The color of this icon when enabled.

disabledContainerColor: Color = Color.Transparent

The background color of this icon button when not enabled.

disabledContentColor: Color = Color.Unspecified

The color of this icon when not enabled.

iconSizeFor

fun iconSizeFor(size: 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
size: Dp

The size of the icon button

iconToggleButtonColors

@Composable
fun iconToggleButtonColors(
    checkedContainerColor: Color = IconToggleButtonTokens.CheckedContainerColor.value,
    checkedContentColor: Color = IconToggleButtonTokens.CheckedContentColor.value,
    uncheckedContainerColor: Color = IconToggleButtonTokens.UncheckedContainerColor.value,
    uncheckedContentColor: Color = IconToggleButtonTokens.UncheckedContentColor.value,
    disabledCheckedContainerColor: Color = IconToggleButtonTokens.DisabledCheckedContainerColor .value.toDisabledColor(IconToggleButtonTokens.DisabledCheckedContainerOpacity),
    disabledCheckedContentColor: Color = IconToggleButtonTokens.DisabledCheckedContentColor .value.toDisabledColor(IconToggleButtonTokens.DisabledCheckedContentOpacity),
    disabledUncheckedContainerColor: Color = IconToggleButtonTokens .DisabledUncheckedContainerColor.value .toDisabledColor(IconToggleButtonTokens.DisabledUncheckedContainerOpacity),
    disabledUncheckedContentColor: Color = IconToggleButtonTokens.DisabledUncheckedContentColor .value.toDisabledColor(IconToggleButtonTokens.DisabledUncheckedContentOpacity)
): ToggleButtonColors

Creates a ToggleButtonColors for a IconToggleButton

  • by default, a colored background with a contrasting content color.

If the button is disabled, then the colors will have an alpha (DisabledContentAlpha and DisabledContainerAlpha) value applied.

Parameters
checkedContainerColor: Color = IconToggleButtonTokens.CheckedContainerColor.value

The container color of this IconToggleButton when enabled and checked

checkedContentColor: Color = IconToggleButtonTokens.CheckedContentColor.value

The content color of this IconToggleButton when enabled and checked

uncheckedContainerColor: Color = IconToggleButtonTokens.UncheckedContainerColor.value

The container color of this IconToggleButton when enabled and unchecked

uncheckedContentColor: Color = IconToggleButtonTokens.UncheckedContentColor.value

The content color of this IconToggleButton when enabled and unchecked

disabledCheckedContainerColor: Color = IconToggleButtonTokens.DisabledCheckedContainerColor .value.toDisabledColor(IconToggleButtonTokens.DisabledCheckedContainerOpacity)

The container color of this IconToggleButton when checked and not enabled

disabledCheckedContentColor: Color = IconToggleButtonTokens.DisabledCheckedContentColor .value.toDisabledColor(IconToggleButtonTokens.DisabledCheckedContentOpacity)

The content color of this IconToggleButton when checked and not enabled

disabledUncheckedContainerColor: Color = IconToggleButtonTokens .DisabledUncheckedContainerColor.value .toDisabledColor(IconToggleButtonTokens.DisabledUncheckedContainerOpacity)

The container color of this IconToggleButton when unchecked and not enabled

disabledUncheckedContentColor: Color = IconToggleButtonTokens.DisabledUncheckedContentColor .value.toDisabledColor(IconToggleButtonTokens.DisabledUncheckedContentOpacity)

The content color of this IconToggleButton when unchecked and not enabled

outlinedIconButtonColors

Added in 1.0.0-alpha21
@Composable
fun outlinedIconButtonColors(): IconButtonColors

Creates a ButtonColors 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
fun outlinedIconButtonColors(
    contentColor: Color = Color.Unspecified,
    disabledContentColor: Color = Color.Unspecified
): IconButtonColors

Creates a ButtonColors 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: Color = Color.Unspecified

The color of this icon button when enabled.

disabledContentColor: Color = Color.Unspecified

The color of this icon when not enabled.

Public properties

DefaultButtonSize

Added in 1.0.0-alpha21
val DefaultButtonSizeDp

The default size applied for buttons. It is recommended to apply this size using Modifier.touchTargetAwareSize.

DefaultIconSize

Added in 1.0.0-alpha21
val DefaultIconSizeDp

The default size of an icon when used inside an icon button of size DefaultButtonSize. Use iconSizeFor to easily determine the icon size.

ExtraSmallButtonSize

Added in 1.0.0-alpha21
val ExtraSmallButtonSizeDp

The recommended background size of an extra small, compact button. It is recommended to apply this size using Modifier.touchTargetAwareSize.

LargeButtonSize

Added in 1.0.0-alpha21
val LargeButtonSizeDp

The recommended size for a large button. It is recommended to apply this size using Modifier.touchTargetAwareSize.

LargeIconSize

Added in 1.0.0-alpha21
val LargeIconSizeDp

The size of an icon when used inside an icon button with size LargeButtonSize. Use iconSizeFor to easily determine the icon size.

SmallButtonSize

Added in 1.0.0-alpha21
val SmallButtonSizeDp

The recommended size for a small button. It is recommended to apply this size using Modifier.touchTargetAwareSize.

SmallIconSize

Added in 1.0.0-alpha21
val SmallIconSizeDp

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.

shape

Added in 1.0.0-alpha21
val shapeShape

Recommended Shape for IconButton.