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