Start native apps faster with the Composables CLI ->
Object

ButtonDefaults

Contains the default values used by Button

Source set: Common
public object ButtonDefaults

Contains the default values used by Button

Properties

ContentPadding

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

The default content padding used by Button

MinWidth

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

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

MinHeight

Source set: Common
public val MinHeight: Dp = 36.dp

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

IconSize

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

The default size of the icon when used inside a Button.

IconSpacing

Source set: Common
public val IconSpacing: Dp = 8.dp

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

OutlinedBorderOpacity

Source set: Common
public const val OutlinedBorderOpacity: Float = 0.12f

The default color opacity used for an OutlinedButton's border color

OutlinedBorderSize

Source set: Common
public val OutlinedBorderSize: Dp = 1.dp

The default OutlinedButton's border size

outlinedBorder

Source set: Common
public val outlinedBorder: BorderStroke

The default disabled content color used by all types of Buttons

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

Functions

elevation

Source set: Common
@Deprecated("Use another overload of elevation", level = DeprecationLevel.HIDDEN)
    @Composable
    public fun elevation(
        defaultElevation: Dp = 2.dp,
        pressedElevation: Dp = 8.dp,
        disabledElevation: Dp = 0.dp,
    ): ButtonElevation

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

Parameters

defaultElevation the elevation to use when the Button is enabled, and has no other Interactions.
pressedElevation the elevation to use when the Button is enabled and is pressed.
disabledElevation the elevation to use when the Button is not enabled.

elevation

Source set: Common
@Composable
    public fun elevation(
        defaultElevation: Dp = 2.dp,
        pressedElevation: Dp = 8.dp,
        disabledElevation: Dp = 0.dp,
        hoveredElevation: Dp = 4.dp,
        focusedElevation: Dp = 4.dp,
    ): ButtonElevation

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

Parameters

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

buttonColors

Source set: Common
@Composable
    public fun buttonColors(
        backgroundColor: Color = MaterialTheme.colors.primary,
        contentColor: Color = contentColorFor(backgroundColor),
        disabledBackgroundColor: Color =
            MaterialTheme.colors.onSurface
                .copy(alpha = 0.12f)
                .compositeOver(MaterialTheme.colors.surface),
        disabledContentColor: Color =
            MaterialTheme.colors.onSurface.copy(alpha = ContentAlpha.disabled),
    ): ButtonColors

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

Parameters

backgroundColor the background color of this Button when enabled
contentColor the content color of this Button when enabled
disabledBackgroundColor the background color of this Button when not enabled
disabledContentColor the content color of this Button when not enabled

outlinedButtonColors

Source set: Common
@Composable
    public fun outlinedButtonColors(
        backgroundColor: Color = MaterialTheme.colors.surface,
        contentColor: Color = MaterialTheme.colors.primary,
        disabledContentColor: Color =
            MaterialTheme.colors.onSurface.copy(alpha = ContentAlpha.disabled),
    ): ButtonColors

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

Parameters

backgroundColor the background color of this OutlinedButton
contentColor the content color of this OutlinedButton when enabled
disabledContentColor the content color of this OutlinedButton when not enabled

textButtonColors

Source set: Common
@Composable
    public fun textButtonColors(
        backgroundColor: Color = Color.Transparent,
        contentColor: Color = MaterialTheme.colors.primary,
        disabledContentColor: Color =
            MaterialTheme.colors.onSurface.copy(alpha = ContentAlpha.disabled),
    ): ButtonColors

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

Parameters

backgroundColor the background color of this TextButton
contentColor the content color of this TextButton when enabled
disabledContentColor the content color of this TextButton when not enabled