public object ButtonDefaults
Contains the default values used by Button.
Properties
ExtraSmallButtonSize
public val ExtraSmallButtonSize: Dp
The default background size of a CompactButton.
SmallButtonSize
public val SmallButtonSize: Dp
The recommended size for a small Button. You can apply this value for the size by overriding Modifier.size directly on Button.
DefaultButtonSize
public val DefaultButtonSize: Dp
The default size applied for the Button. Note that you can override it by applying Modifier.size directly on Button.
LargeButtonSize
public val LargeButtonSize: Dp
The recommended size for a large Button. You can apply this value for the size by overriding Modifier.size directly on Button.
SmallIconSize
public val SmallIconSize: Dp
The size of an icon when used inside a small-sized Button or a CompactButton.
DefaultIconSize
public val DefaultIconSize: Dp
The default size of an icon when used inside a default-sized Button.
LargeIconSize
public val LargeIconSize: Dp
The size of an icon when used inside a large-sized Button.
CompactButtonBackgroundPadding
public val CompactButtonBackgroundPadding: Dp
The default padding for a CompactButton. This will result in a larger tap area than visible area.
Functions
primaryButtonColors
@Composable
public 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 colors will have an alpha (ContentAlpha.disabled) value applied.
Parameters
| backgroundColor | The background color of this Button when enabled |
| contentColor | The content color of this Button when enabled |
secondaryButtonColors
@Composable
public 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 colors will have an alpha (ContentAlpha.disabled) value applied.
Parameters
| backgroundColor | The background color of this Button when enabled |
| contentColor | The content color of this Button when enabled |
iconButtonColors
@Composable
public 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 colors will have an alpha (ContentAlpha.disabled) value applied.
Parameters
| contentColor | The content color of this Button when enabled |
outlinedButtonColors
@Composable
public fun outlinedButtonColors(
contentColor: Color = MaterialTheme.colors.primary
): ButtonColors
Creates a ButtonColors that represents the content colors for an OutlinedButton. If a button is disabled then the colors will have an alpha (ContentAlpha.disabled) value applied.
Parameters
| contentColor | The content color of this OutlinedButton when enabled |
buttonBorder
@Composable
public fun buttonBorder(
borderStroke: BorderStroke? = null,
disabledBorderStroke: BorderStroke? = borderStroke,
): ButtonBorder
Creates a ButtonBorder for the default border used in most Button
Parameters
| borderStroke | The border of this Button when enabled - or no border if null |
| disabledBorderStroke | The border of this Button when disabled - or no border if null |
outlinedButtonBorder
@Composable
public fun outlinedButtonBorder(
borderColor: Color = MaterialTheme.colors.primaryVariant.copy(alpha = 0.6f),
disabledBorderColor: Color = borderColor.copy(alpha = ContentAlpha.disabled),
borderWidth: Dp = 1.dp,
): ButtonBorder
Creates a ButtonBorder for the OutlinedButton
Parameters
| borderColor | The color to use for the border for this OutlinedButton when enabled |
| disabledBorderColor | The color to use for the border for this OutlinedButton when disabled |
| borderWidth | The width to use for the border for this OutlinedButton |
buttonColors
@Composable
public 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 | 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 |