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!)

Creates a ButtonColors that represents the content colors for an icon-only Button.

@Composable ButtonColors
primaryButtonColors(backgroundColor: Color!, contentColor: Color!)

Creates a ButtonColors that represents the default background and content colors for a primary Button.

@Composable ButtonColors
secondaryButtonColors(backgroundColor: Color!, contentColor: Color!)

Creates a ButtonColors that represents the default background and content colors for a secondary Button.

Public properties

Dp

The default padding for a CompactButton.

Dp

The default size applied for the Button.

Dp

The default size of an icon when used inside a default-sized Button.

Dp

The default background size of a CompactButton.

Dp

The recommended size for a large Button.

Dp

The size of an icon when used inside a large-sized Button.

Dp

The recommended size for a small Button.

Dp

The size of an icon when used inside a small-sized Button or a CompactButton.

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)
): 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): ButtonColors

Creates a ButtonColors that represents the content colors for an icon-only Button. If a button is disabled then the color will have an alpha (ContentAlpha.disabled) value applied.

Parameters
contentColor: Color! = MaterialTheme.colors.onSurface

The content color of this Button when enabled

primaryButtonColors

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

Creates a ButtonColors that represents the default background and content colors for a primary Button. Primary buttons have a colored background with a contrasting content color. If a button is disabled then the color will have an alpha (ContentAlpha.disabled) value applied.

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

secondaryButtonColors

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

Creates a ButtonColors that represents the default background and content colors for a secondary Button. Secondary buttons have a muted background with a contrasting content color. If a button is disabled then the color will have an alpha (ContentAlpha.disabled) value applied.

Parameters
backgroundColor: Color! = MaterialTheme.colors.surface

The background color of this Button when enabled

contentColor: Color! = contentColorFor(backgroundColor)

The content color of this Button when enabled

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.

DefaultIconSize

val DefaultIconSizeDp

The default size of an icon when used inside a default-sized 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.

LargeIconSize

val LargeIconSizeDp

The size of an icon when used inside a large-sized 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.

SmallIconSize

val SmallIconSizeDp

The size of an icon when used inside a small-sized Button or a CompactButton.