ButtonDefaults
object ButtonDefaults
Contains the default values used by Button
.
Summary
Public functions |
|
---|---|
@Composable ButtonColors |
buttonColors( Creates a |
@Composable ButtonColors |
iconButtonColors(contentColor: Color!) Creates a |
@Composable ButtonColors |
primaryButtonColors(backgroundColor: Color!, contentColor: Color!) Creates a |
@Composable ButtonColors |
secondaryButtonColors(backgroundColor: Color!, contentColor: Color!) Creates 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
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 color will have an alpha (ContentAlpha.disabled
) value applied.
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.
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.
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
.
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
.
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
.