Object

IconToggleButtonDefaults

Contains the default values used by IconToggleButton.

Source set: Android
public object IconToggleButtonDefaults

Contains the default values used by IconToggleButton.

Properties

shape

Source set: Android
public val shape: RoundedCornerShape

Recommended Shape for IconToggleButton.

pressedShape

Source set: Android
public val pressedShape: CornerBasedShape

Recommended pressed Shape for IconToggleButton.

checkedShape

Source set: Android
public val checkedShape: CornerBasedShape

Recommended checked Shape for IconToggleButton.

SmallIconSize

Source set: Android
public val SmallIconSize: Dp

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

DefaultIconSize

Source set: Android
public val DefaultIconSize: Dp

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

LargeIconSize

Source set: Android
public val LargeIconSize: Dp

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

ExtraLargeIconSize

Source set: Android
public val ExtraLargeIconSize: Dp

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

SmallSize

Source set: Android
public val SmallSize: Dp

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

Size

Source set: Android
public val Size: Dp

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

LargeSize

Source set: Android
public val LargeSize: Dp

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

ExtraLargeSize

Source set: Android
public val ExtraLargeSize: Dp

The recommended size for an extra icon large toggle button. It is recommended to apply this size using Modifier.touchTargetAwareSize.

Functions

iconSizeFor

public fun iconSizeFor(buttonSize: Dp): Dp

Recommended icon size for a given icon toggle button size.

Ensures that the minimum recommended icon size is applied.

Examples: for size SmallSize, returns SmallIconSize, for size ExtraLargeSize returns ExtraLargeIconSize.

Parameters

buttonSize The size of the icon toggle button

shapes

@Composable
public fun shapes(): IconToggleButtonShapes

Returns the default IconToggleButtonShapes for a static IconToggleButton.

shapes

@Composable
public fun shapes(shape: Shape): IconToggleButtonShapes

Returns an IconToggleButtonShapes for an IconToggleButton with a static shape.

Parameters

shape The normal shape of the IconToggleButton.

animatedShapes

@Composable
public fun animatedShapes(): IconToggleButtonShapes

Returns the default IconToggleButtonShapes with an animation between two CornerBasedShapes when pressed.

A simple icon toggle button using the default colors, animated when pressed.

animatedShapes

@Composable
public fun animatedShapes(
    shape: CornerBasedShape? = null,
    pressedShape: CornerBasedShape? = null,
): IconToggleButtonShapes

Returns an IconToggleButtonShapes for an IconToggleButton with an animation between two CornerBasedShapes.

A simple icon toggle button using the default colors, animated when pressed.

Parameters

shape The normal shape of the IconToggleButton when unpressed - if null, the default IconToggleButtonDefaults.shape is used.
pressedShape The pressed shape of the IconToggleButton - if null, the default IconToggleButtonDefaults.pressedShape is used.

variantAnimatedShapes

@Composable
public fun variantAnimatedShapes(): IconToggleButtonShapes

Returns the default IconToggleButtonShapes with an animation between three CornerSizes based on the pressed state and checked/unchecked.

A simple icon toggle button using the default colors, animated on Press and Check/Uncheck:

variantAnimatedShapes

@Composable
public fun variantAnimatedShapes(
    uncheckedShape: CornerBasedShape? = null,
    checkedShape: CornerBasedShape? = null,
): IconToggleButtonShapes

Returns an IconToggleButtonShapes with an animation between three CornerSizes based on the pressed state and checked/unchecked.

A simple icon toggle button using the default colors, animated on Press and Check/Uncheck:

Parameters

uncheckedShape the unchecked shape - if null, the default IconToggleButtonDefaults.shape is used.
checkedShape the checked shape - if null, the default IconToggleButtonDefaults.checkedShape is used.

colors

@Composable
public fun colors(): IconToggleButtonColors

Returns an IconToggleButtonColors 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.

colors

@Composable
public fun colors(
    checkedContainerColor: Color = Color.Unspecified,
    checkedContentColor: Color = Color.Unspecified,
    uncheckedContainerColor: Color = Color.Unspecified,
    uncheckedContentColor: Color = Color.Unspecified,
    disabledCheckedContainerColor: Color = Color.Unspecified,
    disabledCheckedContentColor: Color = Color.Unspecified,
    disabledUncheckedContainerColor: Color = Color.Unspecified,
    disabledUncheckedContentColor: Color = Color.Unspecified,
): IconToggleButtonColors

Returns an IconToggleButtonColors 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 The container color of this IconToggleButton when enabled and checked
checkedContentColor The content color of this IconToggleButton when enabled and checked
uncheckedContainerColor The container color of this IconToggleButton when enabled and unchecked
uncheckedContentColor The content color of this IconToggleButton when enabled and unchecked
disabledCheckedContainerColor The container color of this IconToggleButton when checked and not enabled
disabledCheckedContentColor The content color of this IconToggleButton when checked and not enabled
disabledUncheckedContainerColor The container color of this IconToggleButton when unchecked and not enabled
disabledUncheckedContentColor The content color of this IconToggleButton when unchecked and not enabled

Last updated: