Object

ToggleButtonDefaults

Contains the default values for all five toggle button types.

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Common
@ExperimentalMaterial3ExpressiveApi
object ToggleButtonDefaults

Contains the default values for all five toggle button types.

Properties

Common
val MinHeight = ButtonSmallTokens.ContainerHeight

The default min height applied for all toggle buttons. Note that you can override it by applying Modifier.heightIn directly on the toggle button composable.

Common
val IconSpacing = ButtonSmallTokens.IconLabelSpace

The default size of the spacing between an icon and a text when they used inside any toggle button.

Common
val IconSize = ButtonSmallTokens.IconSize

The default size of the spacing between an icon and a text when they used inside any toggle button.

Common
val ContentPadding =
    PaddingValues(
        start = ToggleButtonStartPadding,
        top = ButtonVerticalPadding,
        end = ToggleButtonEndPadding,
        bottom = ButtonVerticalPadding,
    )

The default content padding used by all toggle buttons.

Common
val roundShape: Shape

A round shape that can be used for all ToggleButtons and its variants

Common
val squareShape: Shape

A square shape that can be used for all ToggleButtons and its variants

Common
val shape: Shape

The default unchecked shape for ToggleButton

Common
val pressedShape: Shape

The default pressed shape for ToggleButton

Common
val checkedShape: Shape

The default checked shape for ToggleButton

Common
val extraSmallSquareShape: Shape

The default square shape for a extra small toggle button

Common
val mediumSquareShape: Shape

The default square shape for a medium toggle button

Common
val largeSquareShape: Shape

The default square shape for a large toggle button

Common
val extraLargeSquareShape: Shape

The default square shape for a extra large toggle button

Common
val extraSmallPressedShape: Shape

The default pressed shape for a extra small toggle button

Common
val mediumPressedShape: Shape

The default pressed shape for a medium toggle button

Common
val largePressedShape: Shape

The default pressed shape for a large toggle button

Common
val extraLargePressedShape: Shape

The default pressed shape for a extra large toggle button

Common
val extraSmallCheckedSquareShape: Shape

The default checked square shape for a extra small toggle button

Common
val mediumCheckedSquareShape: Shape

The default checked square shape for a medium toggle button

Common
val largeCheckedSquareShape: Shape

The default checked square shape for a large toggle button

Common
val extraLargeCheckedSquareShape: Shape

The default checked square shape for a extra large toggle button

Functions

@Composable fun shapes() = MaterialTheme.shapes.defaultToggleButtonShapes

Creates a ToggleButtonShapes that represents the default shape, pressedShape, and checkedShape used in a ToggleButton.

shapes

@Composable
    fun shapes(
        shape: Shape? = null,
        pressedShape: Shape? = null,
        checkedShape: Shape? = null,
    ): ToggleButtonShapes

Creates a ToggleButtonShapes that represents the default shape, pressedShape, and checkedShape used in a ToggleButton and its variants.

Parameters

shape the unchecked shape for ToggleButtonShapes
pressedShape the unchecked shape for ToggleButtonShapes
checkedShape the unchecked shape for ToggleButtonShapes
@Composable fun toggleButtonColors() = MaterialTheme.colorScheme.defaultToggleButtonColors

Creates a ToggleButtonColors that represents the default container and content colors used in a ToggleButton.


toggleButtonColors

@Composable
    fun toggleButtonColors(
        containerColor: Color = Color.Unspecified,
        contentColor: Color = Color.Unspecified,
        disabledContainerColor: Color = Color.Unspecified,
        disabledContentColor: Color = Color.Unspecified,
        checkedContainerColor: Color = Color.Unspecified,
        checkedContentColor: Color = Color.Unspecified,
    ): ToggleButtonColors

Creates a ToggleButtonColors that represents the default container and content colors used in a ToggleButton.

Parameters

containerColor the container color of this ToggleButton when enabled.
contentColor the content color of this ToggleButton when enabled.
disabledContainerColor the container color of this ToggleButton when not enabled.
disabledContentColor the content color of this ToggleButton when not enabled.
checkedContainerColor the container color of this ToggleButton when checked.
checkedContentColor the content color of this ToggleButton when checked.

elevatedToggleButtonColors

@Composable
    fun elevatedToggleButtonColors() = MaterialTheme.colorScheme.defaultElevatedToggleButtonColors

Creates a ToggleButtonColors that represents the default container and content colors used in a ElevatedToggleButton.


elevatedToggleButtonColors

@Composable
    fun elevatedToggleButtonColors(
        containerColor: Color = Color.Unspecified,
        contentColor: Color = Color.Unspecified,
        disabledContainerColor: Color = Color.Unspecified,
        disabledContentColor: Color = Color.Unspecified,
        checkedContainerColor: Color = Color.Unspecified,
        checkedContentColor: Color = Color.Unspecified,
    ): ToggleButtonColors

Creates a ToggleButtonColors that represents the default container and content colors used in a ElevatedToggleButton.

Parameters

containerColor the container color of this ElevatedToggleButton when enabled.
contentColor the content color of this ElevatedToggleButton when enabled.
disabledContainerColor the container color of this ElevatedToggleButton when not enabled.
disabledContentColor the content color of this ElevatedToggleButton when not enabled.
checkedContainerColor the container color of this ElevatedToggleButton when checked.
checkedContentColor the content color of this ElevatedToggleButton when checked.

tonalToggleButtonColors

@Composable
    fun tonalToggleButtonColors() = MaterialTheme.colorScheme.defaultTonalToggleButtonColors

Creates a ToggleButtonColors that represents the default container and content colors used in a TonalToggleButton.


tonalToggleButtonColors

@Composable
    fun tonalToggleButtonColors(
        containerColor: Color = Color.Unspecified,
        contentColor: Color = Color.Unspecified,
        disabledContainerColor: Color = Color.Unspecified,
        disabledContentColor: Color = Color.Unspecified,
        checkedContainerColor: Color = Color.Unspecified,
        checkedContentColor: Color = Color.Unspecified,
    ): ToggleButtonColors

Creates a ToggleButtonColors that represents the default container and content colors used in a TonalToggleButton.

Parameters

containerColor the container color of this TonalToggleButton when enabled.
contentColor the content color of this TonalToggleButton when enabled.
disabledContainerColor the container color of this TonalToggleButton when not enabled.
disabledContentColor the content color of this TonalToggleButton when not enabled.
checkedContainerColor the container color of this TonalToggleButton when checked.
checkedContentColor the content color of this TonalToggleButton when checked.

outlinedToggleButtonColors

@Composable
    fun outlinedToggleButtonColors() = MaterialTheme.colorScheme.defaultOutlinedToggleButtonColors

Creates a ToggleButtonColors that represents the default container and content colors used in a OutlinedToggleButton.


outlinedToggleButtonColors

@Composable
    fun outlinedToggleButtonColors(
        containerColor: Color = Color.Unspecified,
        contentColor: Color = Color.Unspecified,
        disabledContainerColor: Color = Color.Unspecified,
        disabledContentColor: Color = Color.Unspecified,
        checkedContainerColor: Color = Color.Unspecified,
        checkedContentColor: Color = Color.Unspecified,
    ): ToggleButtonColors

Creates a ToggleButtonColors that represents the default container and content colors used in a OutlinedToggleButton.

Parameters

containerColor the container color of this OutlinedToggleButton when enabled.
contentColor the content color of this OutlinedToggleButton when enabled.
disabledContainerColor the container color of this OutlinedToggleButton when not enabled.
disabledContentColor the content color of this OutlinedToggleButton when not enabled.
checkedContainerColor the container color of this OutlinedToggleButton when checked.
checkedContentColor the content color of this OutlinedToggleButton when checked.

shapesFor

@Composable
    fun shapesFor(buttonHeight: Dp): ToggleButtonShapes

Recommended ToggleButtonShapes for a provided toggle button height.

Parameters

buttonHeight The height of the button