ButtonDefaults
-
Cmn
object ButtonDefaults
Contains the default values used by all 5 button types.
Default values that apply to all buttons types are MinWidth, MinHeight, IconSize, and IconSpacing.
A default value that applies only to Button, ElevatedButton, FilledTonalButton, and OutlinedButton is ContentPadding.
Default values that apply only to Button are buttonColors and buttonElevation. Default values that apply only to ElevatedButton are elevatedButtonColors and elevatedButtonElevation. Default values that apply only to FilledTonalButton are filledTonalButtonColors and filledTonalButtonElevation. A default value that applies only to OutlinedButton is outlinedButtonColors. Default values that apply only to TextButton are TextButtonContentPadding and textButtonColors.
Summary
Public functions |
||
|---|---|---|
ButtonColors |
Creates a |
Cmn
|
ButtonColors |
@ComposableCreates a |
Cmn
|
ButtonElevation |
@ComposableCreates a |
Cmn
|
PaddingValues |
@ExperimentalMaterial3ExpressiveApiRecommended |
Cmn
|
ButtonColors |
Creates a |
Cmn
|
ButtonColors |
@ComposableCreates a |
Cmn
|
ButtonElevation |
@ComposableCreates a |
Cmn
|
ButtonColors |
Creates a |
Cmn
|
ButtonColors |
@ComposableCreates a |
Cmn
|
ButtonElevation |
@ComposableCreates a |
Cmn
|
Dp |
@ExperimentalMaterial3ExpressiveApiRecommended Icon size for a provided button height. |
Cmn
|
Dp |
@ExperimentalMaterial3ExpressiveApiRecommended spacing after an |
Cmn
|
BorderStroke |
@ComposableThe default |
Cmn
|
ButtonColors |
Creates a |
Cmn
|
ButtonColors |
@ComposableCreates a |
Cmn
|
ButtonShapes |
Creates a |
Cmn
|
ButtonShapes |
@ComposableCreates a |
Cmn
|
ButtonShapes |
@ComposableRecommended |
Cmn
|
ButtonColors |
Creates a |
Cmn
|
ButtonColors |
@ComposableCreates a |
Cmn
|
TextStyle |
@Composable |
Cmn
|
Public properties |
||
|---|---|---|
PaddingValues |
The default content padding used by |
Cmn
|
PaddingValues |
The default content padding used by |
Cmn
|
Dp |
The default height for a extra large button container. |
Cmn
|
PaddingValues |
Default content padding for an extra large button. |
Cmn
|
Dp |
The default size of the icon used inside of a extra large button. |
Cmn
|
Dp |
The default spacing between an icon and a text when they used inside any extra large button. |
Cmn
|
Dp |
The default height for a extra small button container. |
Cmn
|
PaddingValues |
Default content padding for an extra small button. |
Cmn
|
Dp |
The default size of the icon used inside of a extra small button. |
Cmn
|
Dp |
The default spacing between an icon and a text when they used inside any extra small button. |
Cmn
|
Dp |
The default size of the icon when used inside a small button. |
Cmn
|
Dp |
The default size of the spacing between an icon and a text when they used inside a small button. |
Cmn
|
Dp |
The default height for a large button container. |
Cmn
|
PaddingValues |
Default content padding for a large button. |
Cmn
|
Dp |
The default size of the icon used inside of a large button. |
Cmn
|
Dp |
The default spacing between an icon and a text when they used inside any large button. |
Cmn
|
Dp |
The default height for a medium button container. |
Cmn
|
PaddingValues |
Default content padding for a medium button. |
Cmn
|
Dp |
The default size of the icon used inside of a medium button. |
Cmn
|
Dp |
The default spacing between an icon and a text when they used inside any medium button. |
Cmn
|
Dp |
The default min height applied for small buttons. |
Cmn
|
Dp |
The default min width applied for small buttons. |
Cmn
|
PaddingValues |
The default content padding used for small |
Cmn
|
Dp |
The expressive size of the icon used inside a small button. |
Cmn
|
PaddingValues |
The default content padding used by |
Cmn
|
PaddingValues |
The default content padding used by |
Cmn
|
Shape |
Default shape for an elevated button. |
Cmn
|
Shape |
Pressed shape for extra large buttons. |
Cmn
|
Shape |
Pressed shape for extra small buttons. |
Cmn
|
Shape |
Default shape for a filled tonal button. |
Cmn
|
Shape |
Pressed shape for large buttons. |
Cmn
|
Shape |
Pressed shape for medium buttons. |
Cmn
|
BorderStroke |
The default |
Cmn
|
Shape |
Default shape for an outlined button. |
Cmn
|
Shape |
Pressed shape for default buttons. |
Cmn
|
Shape |
Default shape for a button. |
Cmn
|
Shape |
Square shape for default buttons. |
Cmn
|
Shape |
Default shape for a text button. |
Cmn
|
Public functions
buttonColors
@Composable
fun buttonColors(): ButtonColors
Creates a ButtonColors that represents the default container and content colors used in a Button.
buttonColors
@Composable
fun buttonColors(
containerColor: Color = Color.Unspecified,
contentColor: Color = Color.Unspecified,
disabledContainerColor: Color = Color.Unspecified,
disabledContentColor: Color = Color.Unspecified
): ButtonColors
Creates a ButtonColors that represents the default container and content colors used in a Button.
| Parameters | |
|---|---|
containerColor: Color = Color.Unspecified |
the container color of this |
contentColor: Color = Color.Unspecified |
the content color of this |
disabledContainerColor: Color = Color.Unspecified |
the container color of this |
disabledContentColor: Color = Color.Unspecified |
the content color of this |
buttonElevation
@Composable
fun buttonElevation(
defaultElevation: Dp = FilledButtonTokens.ContainerElevation,
pressedElevation: Dp = FilledButtonTokens.PressedContainerElevation,
focusedElevation: Dp = FilledButtonTokens.FocusedContainerElevation,
hoveredElevation: Dp = FilledButtonTokens.HoveredContainerElevation,
disabledElevation: Dp = FilledButtonTokens.DisabledContainerElevation
): ButtonElevation
Creates a ButtonElevation that will animate between the provided values according to the Material specification for a Button.
| Parameters | |
|---|---|
defaultElevation: Dp = FilledButtonTokens.ContainerElevation |
the elevation used when the |
pressedElevation: Dp = FilledButtonTokens.PressedContainerElevation |
the elevation used when this |
focusedElevation: Dp = FilledButtonTokens.FocusedContainerElevation |
the elevation used when the |
hoveredElevation: Dp = FilledButtonTokens.HoveredContainerElevation |
the elevation used when the |
disabledElevation: Dp = FilledButtonTokens.DisabledContainerElevation |
the elevation used when the |
contentPaddingFor
@ExperimentalMaterial3ExpressiveApi
fun contentPaddingFor(buttonHeight: Dp): PaddingValues
Recommended PaddingValues for a provided button height.
| Parameters | |
|---|---|
buttonHeight: Dp |
The height of the button |
elevatedButtonColors
@Composable
fun elevatedButtonColors(): ButtonColors
Creates a ButtonColors that represents the default container and content colors used in an ElevatedButton.
elevatedButtonColors
@Composable
fun elevatedButtonColors(
containerColor: Color = Color.Unspecified,
contentColor: Color = Color.Unspecified,
disabledContainerColor: Color = Color.Unspecified,
disabledContentColor: Color = Color.Unspecified
): ButtonColors
Creates a ButtonColors that represents the default container and content colors used in an ElevatedButton.
| Parameters | |
|---|---|
containerColor: Color = Color.Unspecified |
the container color of this |
contentColor: Color = Color.Unspecified |
the content color of this |
disabledContainerColor: Color = Color.Unspecified |
the container color of this |
disabledContentColor: Color = Color.Unspecified |
the content color of this |
elevatedButtonElevation
@Composable
fun elevatedButtonElevation(
defaultElevation: Dp = ElevatedButtonTokens.ContainerElevation,
pressedElevation: Dp = ElevatedButtonTokens.PressedContainerElevation,
focusedElevation: Dp = ElevatedButtonTokens.FocusedContainerElevation,
hoveredElevation: Dp = ElevatedButtonTokens.HoveredContainerElevation,
disabledElevation: Dp = ElevatedButtonTokens.DisabledContainerElevation
): ButtonElevation
Creates a ButtonElevation that will animate between the provided values according to the Material specification for a ElevatedButton.
| Parameters | |
|---|---|
defaultElevation: Dp = ElevatedButtonTokens.ContainerElevation |
the elevation used when the |
pressedElevation: Dp = ElevatedButtonTokens.PressedContainerElevation |
the elevation used when this |
focusedElevation: Dp = ElevatedButtonTokens.FocusedContainerElevation |
the elevation used when the |
hoveredElevation: Dp = ElevatedButtonTokens.HoveredContainerElevation |
the elevation used when the |
disabledElevation: Dp = ElevatedButtonTokens.DisabledContainerElevation |
the elevation used when the |
filledTonalButtonColors
@Composable
fun filledTonalButtonColors(): ButtonColors
Creates a ButtonColors that represents the default container and content colors used in an FilledTonalButton.
filledTonalButtonColors
@Composable
fun filledTonalButtonColors(
containerColor: Color = Color.Unspecified,
contentColor: Color = Color.Unspecified,
disabledContainerColor: Color = Color.Unspecified,
disabledContentColor: Color = Color.Unspecified
): ButtonColors
Creates a ButtonColors that represents the default container and content colors used in an FilledTonalButton.
| Parameters | |
|---|---|
containerColor: Color = Color.Unspecified |
the container color of this |
contentColor: Color = Color.Unspecified |
the content color of this |
disabledContainerColor: Color = Color.Unspecified |
the container color of this |
disabledContentColor: Color = Color.Unspecified |
the content color of this |
filledTonalButtonElevation
@Composable
fun filledTonalButtonElevation(
defaultElevation: Dp = FilledTonalButtonTokens.ContainerElevation,
pressedElevation: Dp = FilledTonalButtonTokens.PressedContainerElevation,
focusedElevation: Dp = FilledTonalButtonTokens.FocusContainerElevation,
hoveredElevation: Dp = FilledTonalButtonTokens.HoverContainerElevation,
disabledElevation: Dp = 0.dp
): ButtonElevation
Creates a ButtonElevation that will animate between the provided values according to the Material specification for a FilledTonalButton.
| Parameters | |
|---|---|
defaultElevation: Dp = FilledTonalButtonTokens.ContainerElevation |
the elevation used when the |
pressedElevation: Dp = FilledTonalButtonTokens.PressedContainerElevation |
the elevation used when this |
focusedElevation: Dp = FilledTonalButtonTokens.FocusContainerElevation |
the elevation used when the |
hoveredElevation: Dp = FilledTonalButtonTokens.HoverContainerElevation |
the elevation used when the |
disabledElevation: Dp = 0.dp |
the elevation used when the |
iconSizeFor
@ExperimentalMaterial3ExpressiveApi
fun iconSizeFor(buttonHeight: Dp): Dp
Recommended Icon size for a provided button height.
| Parameters | |
|---|---|
buttonHeight: Dp |
The height of the button |
iconSpacingFor
@ExperimentalMaterial3ExpressiveApi
fun iconSpacingFor(buttonHeight: Dp): Dp
Recommended spacing after an Icon for a provided button height.
| Parameters | |
|---|---|
buttonHeight: Dp |
The height of the button |
outlinedButtonBorder
@Composable
fun outlinedButtonBorder(enabled: Boolean = true): BorderStroke
The default BorderStroke used by OutlinedButton.
| Parameters | |
|---|---|
enabled: Boolean = true |
whether the button is enabled |
outlinedButtonColors
@Composable
fun outlinedButtonColors(): ButtonColors
Creates a ButtonColors that represents the default container and content colors used in an OutlinedButton.
outlinedButtonColors
@Composable
fun outlinedButtonColors(
containerColor: Color = Color.Unspecified,
contentColor: Color = Color.Unspecified,
disabledContainerColor: Color = Color.Unspecified,
disabledContentColor: Color = Color.Unspecified
): ButtonColors
Creates a ButtonColors that represents the default container and content colors used in an OutlinedButton.
| Parameters | |
|---|---|
containerColor: Color = Color.Unspecified |
the container color of this |
contentColor: Color = Color.Unspecified |
the content color of this |
disabledContainerColor: Color = Color.Unspecified |
the container color of this |
disabledContentColor: Color = Color.Unspecified |
the content color of this |
shapes
@ExperimentalMaterial3ExpressiveApi
@Composable
fun shapes(): ButtonShapes
Creates a ButtonShapes that represents the default shape and pressed shape used in a button.
shapes
@Composable
@ExperimentalMaterial3ExpressiveApi
fun shapes(shape: Shape? = null, pressedShape: Shape? = null): ButtonShapes
Creates a ButtonShapes that represents the default shape and pressedShape used in a Button and its variants.
| Parameters | |
|---|---|
shape: Shape? = null |
the unchecked shape for |
pressedShape: Shape? = null |
the unchecked shape for |
shapesFor
@Composable
@ExperimentalMaterial3ExpressiveApi
fun shapesFor(buttonHeight: Dp): ButtonShapes
Recommended ButtonShapes for a provided button height.
| Parameters | |
|---|---|
buttonHeight: Dp |
The height of the button |
textButtonColors
@Composable
fun textButtonColors(): ButtonColors
Creates a ButtonColors that represents the default container and content colors used in a TextButton.
textButtonColors
@Composable
fun textButtonColors(
containerColor: Color = Color.Unspecified,
contentColor: Color = Color.Unspecified,
disabledContainerColor: Color = Color.Unspecified,
disabledContentColor: Color = Color.Unspecified
): ButtonColors
Creates a ButtonColors that represents the default container and content colors used in a TextButton.
| Parameters | |
|---|---|
containerColor: Color = Color.Unspecified |
the container color of this |
contentColor: Color = Color.Unspecified |
the content color of this |
disabledContainerColor: Color = Color.Unspecified |
the container color of this |
disabledContentColor: Color = Color.Unspecified |
the content color of this |
textStyleFor
@Composable
@ExperimentalMaterial3ExpressiveApi
fun textStyleFor(buttonHeight: Dp): TextStyle
Recommended TextStyle for a Text provided a button height.
| Parameters | |
|---|---|
buttonHeight: Dp |
The height of the button |
Public properties
ButtonWithIconContentPadding
val ButtonWithIconContentPadding: PaddingValues
The default content padding used by Button that contains an Icon.
ContentPadding
val ContentPadding: PaddingValues
The default content padding used by Button, ElevatedButton, FilledTonalButton, and OutlinedButton buttons.
-
See
TextButtonContentPaddingorTextButtonWithIconContentPaddingfor content padding used byTextButton. -
See
ButtonWithIconContentPaddingfor content padding used byButtonthat containsIcon.
ExtraLargeContainerHeight
@ExperimentalMaterial3ExpressiveApi
val ExtraLargeContainerHeight: Dp
The default height for a extra large button container.
ExtraLargeContentPadding
@ExperimentalMaterial3ExpressiveApi
val ExtraLargeContentPadding: PaddingValues
Default content padding for an extra large button.
ExtraLargeIconSize
@ExperimentalMaterial3ExpressiveApi
val ExtraLargeIconSize: Dp
The default size of the icon used inside of a extra large button.
ExtraLargeIconSpacing
@ExperimentalMaterial3ExpressiveApi
val ExtraLargeIconSpacing: Dp
The default spacing between an icon and a text when they used inside any extra large button.
ExtraSmallContainerHeight
@ExperimentalMaterial3ExpressiveApi
val ExtraSmallContainerHeight: Dp
The default height for a extra small button container.
ExtraSmallContentPadding
@ExperimentalMaterial3ExpressiveApi
val ExtraSmallContentPadding: PaddingValues
Default content padding for an extra small button.
ExtraSmallIconSize
@ExperimentalMaterial3ExpressiveApi
val ExtraSmallIconSize: Dp
The default size of the icon used inside of a extra small button.
ExtraSmallIconSpacing
@ExperimentalMaterial3ExpressiveApi
val ExtraSmallIconSpacing: Dp
The default spacing between an icon and a text when they used inside any extra small button.
IconSpacing
val IconSpacing: Dp
The default size of the spacing between an icon and a text when they used inside a small button.
LargeContainerHeight
@ExperimentalMaterial3ExpressiveApi
val LargeContainerHeight: Dp
The default height for a large button container.
LargeContentPadding
@ExperimentalMaterial3ExpressiveApi
val LargeContentPadding: PaddingValues
Default content padding for a large button.
LargeIconSize
@ExperimentalMaterial3ExpressiveApi
val LargeIconSize: Dp
The default size of the icon used inside of a large button.
LargeIconSpacing
@ExperimentalMaterial3ExpressiveApi
val LargeIconSpacing: Dp
The default spacing between an icon and a text when they used inside any large button.
MediumContainerHeight
@ExperimentalMaterial3ExpressiveApi
val MediumContainerHeight: Dp
The default height for a medium button container.
MediumContentPadding
@ExperimentalMaterial3ExpressiveApi
val MediumContentPadding: PaddingValues
Default content padding for a medium button.
MediumIconSize
@ExperimentalMaterial3ExpressiveApi
val MediumIconSize: Dp
The default size of the icon used inside of a medium button.
MediumIconSpacing
@ExperimentalMaterial3ExpressiveApi
val MediumIconSpacing: Dp
The default spacing between an icon and a text when they used inside any medium button.
MinHeight
val MinHeight: Dp
The default min height applied for small buttons. Note that you can override it by applying Modifier.heightIn directly on the button composable.
MinWidth
val MinWidth: Dp
The default min width applied for small buttons. Note that you can override it by applying Modifier.widthIn directly on the button composable.
SmallContentPadding
@ExperimentalMaterial3ExpressiveApi
val SmallContentPadding: PaddingValues
The default content padding used for small Button
SmallIconSize
@ExperimentalMaterial3ExpressiveApi
val SmallIconSize: Dp
The expressive size of the icon used inside a small button.
TextButtonContentPadding
val TextButtonContentPadding: PaddingValues
The default content padding used by TextButton.
-
See
TextButtonWithIconContentPaddingfor content padding used byTextButtonthat containsIcon.
TextButtonWithIconContentPadding
val TextButtonWithIconContentPadding: PaddingValues
The default content padding used by TextButton that contains an Icon.
extraLargePressedShape
@ExperimentalMaterial3ExpressiveApi
val extraLargePressedShape: Shape
Pressed shape for extra large buttons.
extraSmallPressedShape
@ExperimentalMaterial3ExpressiveApi
val extraSmallPressedShape: Shape
Pressed shape for extra small buttons.
largePressedShape
@ExperimentalMaterial3ExpressiveApi
val largePressedShape: Shape
Pressed shape for large buttons.
mediumPressedShape
@ExperimentalMaterial3ExpressiveApi
val mediumPressedShape: Shape
Pressed shape for medium buttons.
outlinedButtonBorder
val outlinedButtonBorder: BorderStroke
The default BorderStroke used by OutlinedButton.
pressedShape
@ExperimentalMaterial3ExpressiveApi
val pressedShape: Shape
Pressed shape for default buttons.
squareShape
@ExperimentalMaterial3ExpressiveApi
val squareShape: Shape
Square shape for default buttons.