public 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 is textButtonColors.
Properties
ContentPadding
public val ContentPadding: PaddingValues =
PaddingValues(
start = ButtonLeadingSpace,
top = ButtonVerticalPadding,
end = ButtonTrailingSpace,
bottom = ButtonVerticalPadding,
)
The default content padding used by Button, ElevatedButton, FilledTonalButton, OutlinedButton, and TextButton buttons.
ButtonWithIconContentPadding
public val ButtonWithIconContentPadding: PaddingValues =
PaddingValues(
start = ButtonWithIconStartpadding,
top = ButtonVerticalPadding,
end = ButtonTrailingSpace,
bottom = ButtonVerticalPadding,
)
The default content padding used by Button that contains an Icon.
SmallContentPadding
public val SmallContentPadding: PaddingValues
The default content padding used for small Button
ExtraSmallContentPadding
public val ExtraSmallContentPadding: PaddingValues
Default content padding for an extra small button.
MediumContentPadding
public val MediumContentPadding: PaddingValues
Default content padding for a medium button.
LargeContentPadding
public val LargeContentPadding: PaddingValues
Default content padding for a large button.
ExtraLargeContentPadding
public val ExtraLargeContentPadding: PaddingValues
Default content padding for an extra large button.
TextButtonContentPadding
public val TextButtonContentPadding: PaddingValues =
PaddingValues(
start = TextButtonHorizontalPadding,
top = ContentPadding.calculateTopPadding(),
end = TextButtonHorizontalPadding,
bottom = ContentPadding.calculateBottomPadding(),
)
The default content padding used by TextButton.
- See
TextButtonWithIconContentPaddingfor content padding used by TextButton that
contains Icon.
Note: it's recommended to use ContentPadding instead for a more consistent look between all buttons variants.
TextButtonWithIconContentPadding
public val TextButtonWithIconContentPadding: PaddingValues =
PaddingValues(
start = TextButtonHorizontalPadding,
top = ContentPadding.calculateTopPadding(),
end = TextButtonWithIconHorizontalEndPadding,
bottom = ContentPadding.calculateBottomPadding(),
)
The default content padding used by TextButton that contains an Icon.
Note: it's recommended to use ButtonWithIconContentPadding instead for a more consistent look between all buttons variants.
MinWidth
public val MinWidth: Dp = 58.dp
The default min width applied for small buttons. Note that you can override it by applying Modifier.widthIn directly on the button composable.
MinHeight
public 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.
ExtraSmallContainerHeight
public val ExtraSmallContainerHeight: Dp = ButtonXSmallTokens.ContainerHeight
The default height for a extra small button container.
MediumContainerHeight
public val MediumContainerHeight: Dp = ButtonMediumTokens.ContainerHeight
The default height for a medium button container.
LargeContainerHeight
public val LargeContainerHeight: Dp = ButtonLargeTokens.ContainerHeight
The default height for a large button container.
ExtraLargeContainerHeight
public val ExtraLargeContainerHeight: Dp = ButtonXLargeTokens.ContainerHeight
The default height for a extra large button container.
IconSize
public val IconSize: Dp = 18.dp
The default size of the icon when used inside a small button.
ExtraSmallIconSize
public val ExtraSmallIconSize: Dp = ButtonXSmallTokens.IconSize
The default size of the icon used inside an extra small button.
SmallIconSize
public val SmallIconSize: Dp = ButtonSmallTokens.IconSize
The expressive size of the icon used inside a small button.
MediumIconSize
public val MediumIconSize: Dp = ButtonMediumTokens.IconSize
The default size of the icon used inside a medium button.
LargeIconSize
public val LargeIconSize: Dp = ButtonLargeTokens.IconSize
The default size of the icon used inside a large button.
ExtraLargeIconSize
public val ExtraLargeIconSize: Dp = ButtonXLargeTokens.IconSize
The default size of the icon used inside an extra large button.
IconSpacing
public val IconSpacing: Dp = ButtonSmallTokens.IconLabelSpace
The default size of the spacing between an icon and a text when they used inside a small button.
ExtraSmallIconSpacing
public val ExtraSmallIconSpacing: Dp = 4.dp
The default spacing between an icon and a text when they used inside any extra small button.
MediumIconSpacing
public val MediumIconSpacing: Dp = ButtonMediumTokens.IconLabelSpace
The default spacing between an icon and a text when they're inside any medium button.
LargeIconSpacing
public val LargeIconSpacing: Dp = ButtonLargeTokens.IconLabelSpace
The default spacing between an icon and a text when they're inside any large button.
ExtraLargeIconSpacing
public val ExtraLargeIconSpacing: Dp = ButtonXLargeTokens.IconLabelSpace
The default spacing between an icon and a text when they used inside any extra large button.
squareShape
public val squareShape: Shape
Square shape for default buttons.
pressedShape
public val pressedShape: Shape
Pressed shape for default buttons.
extraSmallPressedShape
public val extraSmallPressedShape: Shape
Pressed shape for extra small buttons.
mediumPressedShape
public val mediumPressedShape: Shape
Pressed shape for medium buttons.
largePressedShape
public val largePressedShape: Shape
Pressed shape for large buttons.
extraLargePressedShape
public val extraLargePressedShape: Shape
Pressed shape for extra large buttons.
shape
public val shape: Shape
Default shape for a button.
elevatedShape
public val elevatedShape: Shape
Default shape for an elevated button.
filledTonalShape
public val filledTonalShape: Shape
Default shape for a filled tonal button.
outlinedShape
public val outlinedShape: Shape
Default shape for an outlined button.
textShape
public val textShape: Shape
Default shape for a text button.
outlinedButtonBorder
public val outlinedButtonBorder: BorderStroke
The default BorderStroke used by OutlinedButton.
Functions
shapes
@Composable public fun shapes(): ButtonShapes
Creates a ButtonShapes that represents the default shape and pressed shape used in a button.
shapes
@Composable
public 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 | the unchecked shape for ButtonShapes |
| pressedShape | the unchecked shape for ButtonShapes |
buttonColors
@Composable
public fun buttonColors(): ButtonColors
Creates a ButtonColors that represents the default container and content colors used in a Button.
buttonColors
@Composable
public 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 | the container color of this Button when enabled. |
| contentColor | the content color of this Button when enabled. |
| disabledContainerColor | the container color of this Button when not enabled. |
| disabledContentColor | the content color of this Button when not enabled. |
elevatedButtonColors
@Composable
public fun elevatedButtonColors(): ButtonColors
Creates a ButtonColors that represents the default container and content colors used in an ElevatedButton.
elevatedButtonColors
@Composable
public 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 | the container color of this ElevatedButton when enabled |
| contentColor | the content color of this ElevatedButton when enabled |
| disabledContainerColor | the container color of this ElevatedButton when not enabled |
| disabledContentColor | the content color of this ElevatedButton when not enabled |
filledTonalButtonColors
@Composable
public fun filledTonalButtonColors(): ButtonColors
Creates a ButtonColors that represents the default container and content colors used in an FilledTonalButton.
filledTonalButtonColors
@Composable
public 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 | the container color of this FilledTonalButton when enabled |
| contentColor | the content color of this FilledTonalButton when enabled |
| disabledContainerColor | the container color of this FilledTonalButton when not enabled |
| disabledContentColor | the content color of this FilledTonalButton when not enabled |
outlinedButtonColors
@Composable
public fun outlinedButtonColors(): ButtonColors
Creates a ButtonColors that represents the default container and content colors used in an OutlinedButton.
outlinedButtonColors
@Composable
public 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 | the container color of this OutlinedButton when enabled |
| contentColor | the content color of this OutlinedButton when enabled |
| disabledContainerColor | the container color of this OutlinedButton when not enabled |
| disabledContentColor | the content color of this OutlinedButton when not enabled |
textButtonColors
@Composable
public fun textButtonColors(): ButtonColors
Creates a ButtonColors that represents the default container and content colors used in a TextButton.
textButtonColors
@Composable
public 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 | the container color of this TextButton when enabled |
| contentColor | the content color of this TextButton when enabled |
| disabledContainerColor | the container color of this TextButton when not enabled |
| disabledContentColor | the content color of this TextButton when not enabled |
buttonElevation
@Composable
public 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 | the elevation used when the Button is enabled, and has no other Interactions. |
| pressedElevation | the elevation used when this Button is enabled and pressed. |
| focusedElevation | the elevation used when the Button is enabled and focused. |
| hoveredElevation | the elevation used when the Button is enabled and hovered. |
| disabledElevation | the elevation used when the Button is not enabled. |
elevatedButtonElevation
@Composable
public 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 | the elevation used when the ElevatedButton is enabled, and has no other Interactions. |
| pressedElevation | the elevation used when this ElevatedButton is enabled and pressed. |
| focusedElevation | the elevation used when the ElevatedButton is enabled and focused. |
| hoveredElevation | the elevation used when the ElevatedButton is enabled and hovered. |
| disabledElevation | the elevation used when the ElevatedButton is not enabled. |
filledTonalButtonElevation
@Composable
public 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 | the elevation used when the FilledTonalButton is enabled, and has no other Interactions. |
| pressedElevation | the elevation used when this FilledTonalButton is enabled and pressed. |
| focusedElevation | the elevation used when the FilledTonalButton is enabled and focused. |
| hoveredElevation | the elevation used when the FilledTonalButton is enabled and hovered. |
| disabledElevation | the elevation used when the FilledTonalButton is not enabled. |
outlinedButtonBorder
@Composable
public fun outlinedButtonBorder(enabled: Boolean = true): BorderStroke
The default BorderStroke used by OutlinedButton.
Parameters
| enabled | whether the button is enabled |
shapesFor
@Composable
public fun shapesFor(buttonHeight: Dp): ButtonShapes
Recommended ButtonShapes for a provided button height.
Parameters
| buttonHeight | The height of the button |
contentPaddingFor
public fun contentPaddingFor(
buttonHeight: Dp,
hasStartIcon: Boolean = false,
hasEndIcon: Boolean = false,
): PaddingValues
Recommended PaddingValues for a provided button height.
The returned content padding is based on the ButtonDefaults.
Parameters
| buttonHeight | The height of the button |
| hasStartIcon | Whether the button has a leading icon |
| hasEndIcon | Whether the button has a trailing icon |
iconSizeFor
public fun iconSizeFor(buttonHeight: Dp): Dp
Recommended Icon size for a provided button height.
Parameters
| buttonHeight | The height of the button |
iconSpacingFor
public fun iconSpacingFor(buttonHeight: Dp): Dp
Recommended spacing after an Icon for a provided button height.
Parameters
| buttonHeight | The height of the button |
textStyleFor
@Composable
public fun textStyleFor(buttonHeight: Dp): TextStyle
Recommended TextStyle for a Text provided a button height.
Parameters
| buttonHeight | The height of the button |