🌈 Create new beautiful Compose Gradients with our new wesite ->
Object

ToggleButtonDefaults

Contains the default values for all five toggle button types.

Source set: Common
public object ToggleButtonDefaults

Contains the default values for all five toggle button types.

Properties

MinHeight

Source set: Common
public val MinHeight: Dp = ButtonSmallTokens.ContainerHeight

The default min height applied for all toggle button variants (ToggleButton, ElevatedToggleButton, FilledTonalToggleButton, OutlinedToggleButton).

Override it by applying Modifier.heightIn directly on the toggle button composable.

IconSpacing

Source set: Common
public val IconSpacing: Dp = 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
public val IconSize: Dp = ButtonSmallTokens.IconSize

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

shape

Source set: Common
public val shape: Shape

The default unchecked shape for ToggleButton

pressedShape

Source set: Common
public val pressedShape: Shape

The default pressed shape for ToggleButton

checkedShape

Source set: Common
public val checkedShape: Shape

The default checked shape for ToggleButton

Functions

contentPaddingFor

Source set: Common
public fun contentPaddingFor(
        buttonHeight: Dp,
        hasStartIcon: Boolean = false,
        hasEndIcon: Boolean = false,
    ): PaddingValues

Recommended PaddingValues for a provided toggle button height.

This padding is the same across all toggle button variants and should be used with ToggleButton, ElevatedToggleButton, FilledTonalToggleButton, and OutlinedToggleButton.

The returned content padding is based on standard container height values and is not directly interpolated from the provided buttonHeight.

Parameters

buttonHeight the height of the toggle button
hasStartIcon whether the toggle button has a leading icon
hasEndIcon whether the toggle button has a trailing icon

contentPaddingFor

Source set: Common
public fun contentPaddingFor(
        buttonSize: ToggleButtonSize,
        hasStartIcon: Boolean = false,
        hasEndIcon: Boolean = false,
    ): PaddingValues

Recommended PaddingValues for a provided buttonSize.

This padding is the same across all toggle button variants and should be used with ToggleButton, ElevatedToggleButton, FilledTonalToggleButton, and OutlinedToggleButton.

Parameters

buttonSize the ToggleButtonSize of the toggle button
hasStartIcon whether the toggle button has a leading icon
hasEndIcon whether the toggle button has a trailing icon

elevation

Source set: Common
@Composable
    public fun elevation(
        defaultElevation: Dp = FilledButtonTokens.ContainerElevation,
        pressedElevation: Dp = FilledButtonTokens.PressedContainerElevation,
        focusedElevation: Dp = FilledButtonTokens.FocusedContainerElevation,
        hoveredElevation: Dp = FilledButtonTokens.HoveredContainerElevation,
        disabledElevation: Dp = FilledButtonTokens.DisabledContainerElevation,
    ): ToggleButtonElevation

Creates a ToggleButtonElevation that will animate between the provided values according to the Material specification for a ToggleButton.

Parameters

defaultElevation the elevation used when the ToggleButton is enabled, and has no other Interactions.
pressedElevation the elevation used when this ToggleButton is enabled and pressed.
focusedElevation the elevation used when the ToggleButton is enabled and focused.
hoveredElevation the elevation used when the ToggleButton is enabled and hovered.
disabledElevation the elevation used when the ToggleButton is not enabled.

shapes

Source set: Common
@Deprecated("Maintained for binary compatibility.", level = DeprecationLevel.HIDDEN)
    @Composable
    public fun shapes(): ToggleButtonShapes

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

shapes

Source set: Common
@Deprecated("Maintained for binary compatibility.", level = DeprecationLevel.HIDDEN)
    @Composable
    public 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

colors

Source set: Common
@Composable
    public fun colors(): ToggleButtonColors

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

colors

Source set: Common
@Composable
    public fun colors(
        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

Source set: Common
@Deprecated("Maintained for binary compatibility.", level = DeprecationLevel.HIDDEN)
    @Composable
    public fun elevatedToggleButtonColors(): ToggleButtonColors

elevatedToggleButtonColors

Source set: Common
@Deprecated("Maintained for binary compatibility.", level = DeprecationLevel.HIDDEN)
    @Composable
    public 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

tonalToggleButtonColors

Source set: Common
@Deprecated("Maintained for binary compatibility.", level = DeprecationLevel.HIDDEN)
    @Composable
    public fun tonalToggleButtonColors(): ToggleButtonColors

tonalToggleButtonColors

Source set: Common
@Deprecated("Maintained for binary compatibility.", level = DeprecationLevel.HIDDEN)
    @Composable
    public 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

filledTonalToggleButtonColors

Source set: Common
@Deprecated("Maintained for binary compatibility.", level = DeprecationLevel.HIDDEN)
    @Composable
    public fun filledTonalToggleButtonColors(): ToggleButtonColors

filledTonalToggleButtonColors

Source set: Common
@Deprecated("Maintained for binary compatibility.", level = DeprecationLevel.HIDDEN)
    @Composable
    public fun filledTonalToggleButtonColors(
        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

outlinedToggleButtonColors

Source set: Common
@Deprecated("Maintained for binary compatibility.", level = DeprecationLevel.HIDDEN)
    @Composable
    public fun outlinedToggleButtonColors(): ToggleButtonColors

outlinedToggleButtonColors

Source set: Common
@Deprecated("Maintained for binary compatibility.", level = DeprecationLevel.HIDDEN)
    @Composable
    public 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

outlinedToggleButtonBorder

Source set: Common
@Deprecated("Maintained for binary compatibility.", level = DeprecationLevel.HIDDEN)
    @Composable
    public fun outlinedToggleButtonBorder(enabled: Boolean, checked: Boolean): BorderStroke?

shapesFor

Source set: Common
@Composable
    public fun shapesFor(buttonHeight: Dp): ToggleButtonShapes

Resolves the recommended ToggleButtonShapes for a given toggle button height.

These shapes are the same across all toggle button variants and should be used with ToggleButton, ElevatedToggleButton, FilledTonalToggleButton, and OutlinedToggleButton.

The input height is categorized into a shape bucket (such as extra small, small, medium, large, or extra large) based on the closest standard button height.

Parameters

buttonHeight height of the button used to resolve the shape bucket

shapesFor

Source set: Common
@Composable
    public fun shapesFor(buttonSize: ToggleButtonSize): ToggleButtonShapes

Resolves the recommended ToggleButtonShapes for a given buttonSize.

These shapes are the same across all toggle button variants and should be used with ToggleButton, ElevatedToggleButton, FilledTonalToggleButton, and OutlinedToggleButton.

Parameters

buttonSize ToggleButtonSize used to resolve the shape bucket

Content updated: