Object

ToggleButtonDefaults

Contains the default values for all five toggle button types.

Source set: Common

Added in 1.5.0-alpha17

@ExperimentalMaterial3ExpressiveApi
object ToggleButtonDefaults

Contains the default values for all five toggle button types.

Properties

MinHeight

Source set: Common

Added in 1.5.0-alpha17

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.

IconSpacing

Source set: Common

Added in 1.5.0-alpha17

val IconSpacing = ButtonSmallTokens.IconLabelSpace

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

IconSize

Source set: Common

Added in 1.5.0-alpha17

val IconSize = ButtonSmallTokens.IconSize

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

ContentPadding

Source set: Common

Added in 1.5.0-alpha17

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

The default content padding used by all toggle buttons.

roundShape

Source set: Common

Added in 1.5.0-alpha17

val roundShape: Shape

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

squareShape

Source set: Common

Added in 1.5.0-alpha17

val squareShape: Shape

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

shape

Source set: Common

Added in 1.5.0-alpha17

val shape: Shape

The default unchecked shape for ToggleButton

pressedShape

Source set: Common

Added in 1.5.0-alpha17

val pressedShape: Shape

The default pressed shape for ToggleButton

checkedShape

Source set: Common

Added in 1.5.0-alpha17

val checkedShape: Shape

The default checked shape for ToggleButton

extraSmallSquareShape

Source set: Common

Added in 1.5.0-alpha17

val extraSmallSquareShape: Shape

The default square shape for a extra small toggle button

mediumSquareShape

Source set: Common

Added in 1.5.0-alpha17

val mediumSquareShape: Shape

The default square shape for a medium toggle button

largeSquareShape

Source set: Common

Added in 1.5.0-alpha17

val largeSquareShape: Shape

The default square shape for a large toggle button

extraLargeSquareShape

Source set: Common

Added in 1.5.0-alpha17

val extraLargeSquareShape: Shape

The default square shape for a extra large toggle button

extraSmallPressedShape

Source set: Common

Added in 1.5.0-alpha17

val extraSmallPressedShape: Shape

The default pressed shape for a extra small toggle button

mediumPressedShape

Source set: Common

Added in 1.5.0-alpha17

val mediumPressedShape: Shape

The default pressed shape for a medium toggle button

largePressedShape

Source set: Common

Added in 1.5.0-alpha17

val largePressedShape: Shape

The default pressed shape for a large toggle button

extraLargePressedShape

Source set: Common

Added in 1.5.0-alpha17

val extraLargePressedShape: Shape

The default pressed shape for a extra large toggle button

extraSmallCheckedSquareShape

Source set: Common

Added in 1.5.0-alpha17

val extraSmallCheckedSquareShape: Shape

The default checked square shape for a extra small toggle button

mediumCheckedSquareShape

Source set: Common

Added in 1.5.0-alpha17

val mediumCheckedSquareShape: Shape

The default checked square shape for a medium toggle button

largeCheckedSquareShape

Source set: Common

Added in 1.5.0-alpha17

val largeCheckedSquareShape: Shape

The default checked square shape for a large toggle button

extraLargeCheckedSquareShape

Source set: Common

Added in 1.5.0-alpha17

val extraLargeCheckedSquareShape: Shape

The default checked square shape for a extra large toggle button

Functions

shapes

Added in 1.5.0-alpha17

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

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

shapes

Added in 1.5.0-alpha17

@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

toggleButtonColors

Added in 1.5.0-alpha17

@Composable fun toggleButtonColors() = MaterialTheme.colorScheme.defaultToggleButtonColors

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

toggleButtonColors

Added in 1.5.0-alpha17

@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

Added in 1.5.0-alpha17

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

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

elevatedToggleButtonColors

Added in 1.5.0-alpha17

@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

Added in 1.5.0-alpha17

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

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

tonalToggleButtonColors

Added in 1.5.0-alpha17

@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

Added in 1.5.0-alpha17

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

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

outlinedToggleButtonColors

Added in 1.5.0-alpha17

@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

Added in 1.5.0-alpha17

@Composable
    fun shapesFor(buttonHeight: Dp): ToggleButtonShapes

Recommended ToggleButtonShapes for a provided toggle button height.

Parameters

buttonHeight The height of the button