ButtonDefaults

object ButtonDefaults


Contains the default values used by Button.

Summary

Public functions

@Composable ButtonColors
buttonColors(
    backgroundColor: Color,
    contentColor: Color,
    disabledBackgroundColor: Color,
    disabledContentColor: Color
)

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

@Composable ButtonColors
iconButtonColors(contentColor: Color)
@Composable ButtonColors
primaryButtonColors(backgroundColor: Color, contentColor: Color)
@Composable ButtonColors
secondaryButtonColors(backgroundColor: Color, contentColor: Color)

Public properties

Dp

The default padding for a CompactButton.

Dp

The default size applied for the Button.

Dp

The default background size of a CompactButton.

Dp

The recommended size for a large Button.

Dp

The recommended size for a small Button.

Public functions

buttonColors

@Composable
fun buttonColors(
    backgroundColor: Color = MaterialTheme.colors.primary,
    contentColor: Color = contentColorFor(backgroundColor),
    disabledBackgroundColor: Color = backgroundColor.copy(alpha = ContentAlpha.disabled),
    disabledContentColor: Color = contentColor.copy(alpha = ContentAlpha.disabled)
): @Composable ButtonColors

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

Parameters
backgroundColor: Color = MaterialTheme.colors.primary

the background color of this Button when enabled

contentColor: Color = contentColorFor(backgroundColor)

the content color of this Button when enabled

disabledBackgroundColor: Color = backgroundColor.copy(alpha = ContentAlpha.disabled)

the background color of this Button when not enabled

disabledContentColor: Color = contentColor.copy(alpha = ContentAlpha.disabled)

the content color of this Button when not enabled

iconButtonColors

@Composable
fun iconButtonColors(contentColor: Color = MaterialTheme.colors.onSurface): @Composable ButtonColors

primaryButtonColors

@Composable
fun primaryButtonColors(
    backgroundColor: Color = MaterialTheme.colors.primary,
    contentColor: Color = contentColorFor(backgroundColor)
): @Composable ButtonColors

secondaryButtonColors

@Composable
fun secondaryButtonColors(
    backgroundColor: Color = MaterialTheme.colors.surface,
    contentColor: Color = contentColorFor(backgroundColor)
): @Composable ButtonColors

Public properties

CompactButtonBackgroundPadding

val CompactButtonBackgroundPaddingDp

The default padding for a CompactButton. This will result in a larger tap area than visible area.

DefaultButtonSize

val DefaultButtonSizeDp

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

ExtraSmallButtonSize

val ExtraSmallButtonSizeDp

The default background size of a CompactButton.

LargeButtonSize

val LargeButtonSizeDp

The recommended size for a large Button. You can apply this value for the size by overriding Modifier.size directly on Button.

SmallButtonSize

val SmallButtonSizeDp

The recommended size for a small Button. You can apply this value for the size by overriding Modifier.size directly on Button.