Start native apps faster with the Composables CLI ->
Object

ButtonDefaults

Contains the default values used by all 5 button types.

Source set: Common
public object ButtonDefaults

Contains the default values used by all 5 button types.

Default values that apply to all buttons types are MinWidth, MinHeight, IconSize, and IconSpacing.

A default value that applies only to Button, ElevatedButton, FilledTonalButton, and OutlinedButton is ContentPadding.

Default values that apply only to Button are buttonColors and buttonElevation. Default values that apply only to ElevatedButton are elevatedButtonColors and elevatedButtonElevation. Default values that apply only to FilledTonalButton are filledTonalButtonColors and filledTonalButtonElevation. A default value that applies only to OutlinedButton is outlinedButtonColors. Default values that apply only to TextButton is textButtonColors.

Properties

ContentPadding

Source set: Common
public val ContentPadding: PaddingValues =
        PaddingValues(
            start = ButtonLeadingSpace,
            top = ButtonVerticalPadding,
            end = ButtonTrailingSpace,
            bottom = ButtonVerticalPadding,
        )

The default content padding used by Button, ElevatedButton, FilledTonalButton, OutlinedButton, and TextButton buttons.

    Icon.

  • See ButtonWithIconContentPadding for content padding used by Button that contains

ButtonWithIconContentPadding

Source set: Common
public val ButtonWithIconContentPadding: PaddingValues =
        PaddingValues(
            start = ButtonWithIconStartpadding,
            top = ButtonVerticalPadding,
            end = ButtonTrailingSpace,
            bottom = ButtonVerticalPadding,
        )

The default content padding used by Button that contains an Icon.

SmallContentPadding

Source set: Common
public val SmallContentPadding: PaddingValues

The default content padding used for small Button

ExtraSmallContentPadding

Source set: Common
public val ExtraSmallContentPadding: PaddingValues

Default content padding for an extra small button.

MediumContentPadding

Source set: Common
public val MediumContentPadding: PaddingValues

Default content padding for a medium button.

LargeContentPadding

Source set: Common
public val LargeContentPadding: PaddingValues

Default content padding for a large button.

ExtraLargeContentPadding

Source set: Common
public val ExtraLargeContentPadding: PaddingValues

Default content padding for an extra large button.

TextButtonContentPadding

Source set: Common
public val TextButtonContentPadding: PaddingValues =
        PaddingValues(
            start = TextButtonHorizontalPadding,
            top = ContentPadding.calculateTopPadding(),
            end = TextButtonHorizontalPadding,
            bottom = ContentPadding.calculateBottomPadding(),
        )

The default content padding used by TextButton.

    contains Icon.

  • See TextButtonWithIconContentPadding for content padding used by TextButton that

Note: it's recommended to use ContentPadding instead for a more consistent look between all buttons variants.

TextButtonWithIconContentPadding

Source set: Common
public val TextButtonWithIconContentPadding: PaddingValues =
        PaddingValues(
            start = TextButtonHorizontalPadding,
            top = ContentPadding.calculateTopPadding(),
            end = TextButtonWithIconHorizontalEndPadding,
            bottom = ContentPadding.calculateBottomPadding(),
        )

The default content padding used by TextButton that contains an Icon.

Note: it's recommended to use ButtonWithIconContentPadding instead for a more consistent look between all buttons variants.

MinWidth

Source set: Common
public val MinWidth: Dp = 58.dp

The default min width applied for small buttons. Note that you can override it by applying Modifier.widthIn directly on the button composable.

MinHeight

Source set: Common
public val MinHeight: Dp

The default min height applied for small buttons. Note that you can override it by applying Modifier.heightIn directly on the button composable.

ExtraSmallContainerHeight

Source set: Common
public val ExtraSmallContainerHeight: Dp = ButtonXSmallTokens.ContainerHeight

The default height for a extra small button container.

MediumContainerHeight

Source set: Common
public val MediumContainerHeight: Dp = ButtonMediumTokens.ContainerHeight

The default height for a medium button container.

LargeContainerHeight

Source set: Common
public val LargeContainerHeight: Dp = ButtonLargeTokens.ContainerHeight

The default height for a large button container.

ExtraLargeContainerHeight

Source set: Common
public val ExtraLargeContainerHeight: Dp = ButtonXLargeTokens.ContainerHeight

The default height for a extra large button container.

IconSize

Source set: Common
public val IconSize: Dp = 18.dp

The default size of the icon when used inside a small button.

ExtraSmallIconSize

Source set: Common
public val ExtraSmallIconSize: Dp = ButtonXSmallTokens.IconSize

The default size of the icon used inside an extra small button.

SmallIconSize

Source set: Common
public val SmallIconSize: Dp = ButtonSmallTokens.IconSize

The expressive size of the icon used inside a small button.

MediumIconSize

Source set: Common
public val MediumIconSize: Dp = ButtonMediumTokens.IconSize

The default size of the icon used inside a medium button.

LargeIconSize

Source set: Common
public val LargeIconSize: Dp = ButtonLargeTokens.IconSize

The default size of the icon used inside a large button.

ExtraLargeIconSize

Source set: Common
public val ExtraLargeIconSize: Dp = ButtonXLargeTokens.IconSize

The default size of the icon used inside an extra large button.

IconSpacing

Source set: Common
public val IconSpacing: Dp = ButtonSmallTokens.IconLabelSpace

The default size of the spacing between an icon and a text when they used inside a small button.

ExtraSmallIconSpacing

Source set: Common
public val ExtraSmallIconSpacing: Dp = 4.dp

The default spacing between an icon and a text when they used inside any extra small button.

MediumIconSpacing

Source set: Common
public val MediumIconSpacing: Dp = ButtonMediumTokens.IconLabelSpace

The default spacing between an icon and a text when they're inside any medium button.

LargeIconSpacing

Source set: Common
public val LargeIconSpacing: Dp = ButtonLargeTokens.IconLabelSpace

The default spacing between an icon and a text when they're inside any large button.

ExtraLargeIconSpacing

Source set: Common
public val ExtraLargeIconSpacing: Dp = ButtonXLargeTokens.IconLabelSpace

The default spacing between an icon and a text when they used inside any extra large button.

squareShape

Source set: Common
public val squareShape: Shape

Square shape for default buttons.

pressedShape

Source set: Common
public val pressedShape: Shape

Pressed shape for default buttons.

extraSmallPressedShape

Source set: Common
public val extraSmallPressedShape: Shape

Pressed shape for extra small buttons.

mediumPressedShape

Source set: Common
public val mediumPressedShape: Shape

Pressed shape for medium buttons.

largePressedShape

Source set: Common
public val largePressedShape: Shape

Pressed shape for large buttons.

extraLargePressedShape

Source set: Common
public val extraLargePressedShape: Shape

Pressed shape for extra large buttons.

shape

Source set: Common
public val shape: Shape

Default shape for a button.

elevatedShape

Source set: Common
public val elevatedShape: Shape

Default shape for an elevated button.

filledTonalShape

Source set: Common
public val filledTonalShape: Shape

Default shape for a filled tonal button.

outlinedShape

Source set: Common
public val outlinedShape: Shape

Default shape for an outlined button.

textShape

Source set: Common
public val textShape: Shape

Default shape for a text button.

outlinedButtonBorder

Source set: Common
public val outlinedButtonBorder: BorderStroke

The default BorderStroke used by OutlinedButton.

Functions

shapes

Source set: Common
@Composable public fun shapes(): ButtonShapes

Creates a ButtonShapes that represents the default shape and pressed shape used in a button.

shapes

Source set: Common
@Composable
    public fun shapes(shape: Shape? = null, pressedShape: Shape? = null): ButtonShapes

Creates a ButtonShapes that represents the default shape and pressedShape used in a Button and its variants.

Parameters

shape the unchecked shape for ButtonShapes
pressedShape the unchecked shape for ButtonShapes

buttonColors

Source set: Common
@Composable
    public fun buttonColors(): ButtonColors

Creates a ButtonColors that represents the default container and content colors used in a Button.

buttonColors

Source set: Common
@Composable
    public fun buttonColors(
        containerColor: Color = Color.Unspecified,
        contentColor: Color = Color.Unspecified,
        disabledContainerColor: Color = Color.Unspecified,
        disabledContentColor: Color = Color.Unspecified,
    ): ButtonColors

Creates a ButtonColors that represents the default container and content colors used in a Button.

Parameters

containerColor the container color of this Button when enabled.
contentColor the content color of this Button when enabled.
disabledContainerColor the container color of this Button when not enabled.
disabledContentColor the content color of this Button when not enabled.

elevatedButtonColors

Source set: Common
@Composable
    public fun elevatedButtonColors(): ButtonColors

Creates a ButtonColors that represents the default container and content colors used in an ElevatedButton.

elevatedButtonColors

Source set: Common
@Composable
    public fun elevatedButtonColors(
        containerColor: Color = Color.Unspecified,
        contentColor: Color = Color.Unspecified,
        disabledContainerColor: Color = Color.Unspecified,
        disabledContentColor: Color = Color.Unspecified,
    ): ButtonColors

Creates a ButtonColors that represents the default container and content colors used in an ElevatedButton.

Parameters

containerColor the container color of this ElevatedButton when enabled
contentColor the content color of this ElevatedButton when enabled
disabledContainerColor the container color of this ElevatedButton when not enabled
disabledContentColor the content color of this ElevatedButton when not enabled

filledTonalButtonColors

Source set: Common
@Composable
    public fun filledTonalButtonColors(): ButtonColors

Creates a ButtonColors that represents the default container and content colors used in an FilledTonalButton.

filledTonalButtonColors

Source set: Common
@Composable
    public fun filledTonalButtonColors(
        containerColor: Color = Color.Unspecified,
        contentColor: Color = Color.Unspecified,
        disabledContainerColor: Color = Color.Unspecified,
        disabledContentColor: Color = Color.Unspecified,
    ): ButtonColors

Creates a ButtonColors that represents the default container and content colors used in an FilledTonalButton.

Parameters

containerColor the container color of this FilledTonalButton when enabled
contentColor the content color of this FilledTonalButton when enabled
disabledContainerColor the container color of this FilledTonalButton when not enabled
disabledContentColor the content color of this FilledTonalButton when not enabled

outlinedButtonColors

Source set: Common
@Composable
    public fun outlinedButtonColors(): ButtonColors

Creates a ButtonColors that represents the default container and content colors used in an OutlinedButton.

outlinedButtonColors

Source set: Common
@Composable
    public fun outlinedButtonColors(
        containerColor: Color = Color.Unspecified,
        contentColor: Color = Color.Unspecified,
        disabledContainerColor: Color = Color.Unspecified,
        disabledContentColor: Color = Color.Unspecified,
    ): ButtonColors

Creates a ButtonColors that represents the default container and content colors used in an OutlinedButton.

Parameters

containerColor the container color of this OutlinedButton when enabled
contentColor the content color of this OutlinedButton when enabled
disabledContainerColor the container color of this OutlinedButton when not enabled
disabledContentColor the content color of this OutlinedButton when not enabled

textButtonColors

Source set: Common
@Composable
    public fun textButtonColors(): ButtonColors

Creates a ButtonColors that represents the default container and content colors used in a TextButton.

textButtonColors

Source set: Common
@Composable
    public fun textButtonColors(
        containerColor: Color = Color.Unspecified,
        contentColor: Color = Color.Unspecified,
        disabledContainerColor: Color = Color.Unspecified,
        disabledContentColor: Color = Color.Unspecified,
    ): ButtonColors

Creates a ButtonColors that represents the default container and content colors used in a TextButton.

Parameters

containerColor the container color of this TextButton when enabled
contentColor the content color of this TextButton when enabled
disabledContainerColor the container color of this TextButton when not enabled
disabledContentColor the content color of this TextButton when not enabled

buttonElevation

Source set: Common
@Composable
    public fun buttonElevation(
        defaultElevation: Dp = FilledButtonTokens.ContainerElevation,
        pressedElevation: Dp = FilledButtonTokens.PressedContainerElevation,
        focusedElevation: Dp = FilledButtonTokens.FocusedContainerElevation,
        hoveredElevation: Dp = FilledButtonTokens.HoveredContainerElevation,
        disabledElevation: Dp = FilledButtonTokens.DisabledContainerElevation,
    ): ButtonElevation

Creates a ButtonElevation that will animate between the provided values according to the Material specification for a Button.

Parameters

defaultElevation the elevation used when the Button is enabled, and has no other Interactions.
pressedElevation the elevation used when this Button is enabled and pressed.
focusedElevation the elevation used when the Button is enabled and focused.
hoveredElevation the elevation used when the Button is enabled and hovered.
disabledElevation the elevation used when the Button is not enabled.

elevatedButtonElevation

Source set: Common
@Composable
    public fun elevatedButtonElevation(
        defaultElevation: Dp = ElevatedButtonTokens.ContainerElevation,
        pressedElevation: Dp = ElevatedButtonTokens.PressedContainerElevation,
        focusedElevation: Dp = ElevatedButtonTokens.FocusedContainerElevation,
        hoveredElevation: Dp = ElevatedButtonTokens.HoveredContainerElevation,
        disabledElevation: Dp = ElevatedButtonTokens.DisabledContainerElevation,
    ): ButtonElevation

Creates a ButtonElevation that will animate between the provided values according to the Material specification for a ElevatedButton.

Parameters

defaultElevation the elevation used when the ElevatedButton is enabled, and has no other Interactions.
pressedElevation the elevation used when this ElevatedButton is enabled and pressed.
focusedElevation the elevation used when the ElevatedButton is enabled and focused.
hoveredElevation the elevation used when the ElevatedButton is enabled and hovered.
disabledElevation the elevation used when the ElevatedButton is not enabled.

filledTonalButtonElevation

Source set: Common
@Composable
    public fun filledTonalButtonElevation(
        defaultElevation: Dp = FilledTonalButtonTokens.ContainerElevation,
        pressedElevation: Dp = FilledTonalButtonTokens.PressedContainerElevation,
        focusedElevation: Dp = FilledTonalButtonTokens.FocusContainerElevation,
        hoveredElevation: Dp = FilledTonalButtonTokens.HoverContainerElevation,
        disabledElevation: Dp = 0.dp,
    ): ButtonElevation

Creates a ButtonElevation that will animate between the provided values according to the Material specification for a FilledTonalButton.

Parameters

defaultElevation the elevation used when the FilledTonalButton is enabled, and has no other Interactions.
pressedElevation the elevation used when this FilledTonalButton is enabled and pressed.
focusedElevation the elevation used when the FilledTonalButton is enabled and focused.
hoveredElevation the elevation used when the FilledTonalButton is enabled and hovered.
disabledElevation the elevation used when the FilledTonalButton is not enabled.

outlinedButtonBorder

Source set: Common
@Composable
    public fun outlinedButtonBorder(enabled: Boolean = true): BorderStroke

The default BorderStroke used by OutlinedButton.

Parameters

enabled whether the button is enabled

shapesFor

Source set: Common
@Composable
    public fun shapesFor(buttonHeight: Dp): ButtonShapes

Recommended ButtonShapes for a provided button height.

Parameters

buttonHeight The height of the button

contentPaddingFor

Source set: Common
public fun contentPaddingFor(
        buttonHeight: Dp,
        hasStartIcon: Boolean = false,
        hasEndIcon: Boolean = false,
    ): PaddingValues

Recommended PaddingValues for a provided button height.

The returned content padding is based on the ButtonDefaults.ContainerHeight (or ButtonDefaults.MinHeight for a small button) height values and is not directly interpolated from the provided buttonHeight (e.g. any buttonHeight equal or bigger than ButtonDefaults.MinHeight and smaller than ButtonDefaults.MediumContainerHeight will return the same small content padding).

Parameters

buttonHeight The height of the button
hasStartIcon Whether the button has a leading icon
hasEndIcon Whether the button has a trailing icon

iconSizeFor

Source set: Common
public fun iconSizeFor(buttonHeight: Dp): Dp

Recommended Icon size for a provided button height.

Parameters

buttonHeight The height of the button

iconSpacingFor

Source set: Common
public fun iconSpacingFor(buttonHeight: Dp): Dp

Recommended spacing after an Icon for a provided button height.

Parameters

buttonHeight The height of the button

textStyleFor

Source set: Common
@Composable
    public fun textStyleFor(buttonHeight: Dp): TextStyle

Recommended TextStyle for a Text provided a button height.

Parameters

buttonHeight The height of the button