Android 12 Developer Preview is here! Try it out, and give us your feedback!

ButtonDefaults

object ButtonDefaults
kotlin.Any
   ↳ androidx.compose.material.ButtonDefaults

Contains the default values used by Button

Summary

Constants
const Float

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

Public methods
ButtonColors
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))

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

ButtonElevation
elevation(defaultElevation: Dp = 2.dp, pressedElevation: Dp = 8.dp, disabledElevation: Dp = 0.dp)

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

ButtonColors
outlinedButtonColors(backgroundColor: Color = MaterialTheme.colors.surface, contentColor: Color = MaterialTheme.colors.primary, disabledContentColor: Color = MaterialTheme.colors.onSurface .copy(alpha = ContentAlpha.disabled))

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

ButtonColors
textButtonColors(backgroundColor: Color = Color.Transparent, contentColor: Color = MaterialTheme.colors.primary, disabledContentColor: Color = MaterialTheme.colors.onSurface .copy(alpha = ContentAlpha.disabled))

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

Properties
PaddingValues

The default content padding used by Button

Dp

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

Dp

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

Dp

The default min width applied for the Button.

Dp

The default min width applied for the Button.

Dp

The default OutlinedButton's border size

PaddingValues

The default content padding used by TextButton

BorderStroke

The default disabled content color used by all types of Buttons

Constants

OutlinedBorderOpacity

const val OutlinedBorderOpacity: Float

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

Value: 0.12f

Public methods

buttonColors

@Composable fun buttonColors(
    backgroundColor: Color = Mater