Object

ToggleButtonDefaults

Contains default values used by ToggleButtons.

Source set: Android
public object ToggleButtonDefaults

Contains default values used by ToggleButtons.

Properties

CheckedShape

Source set: Android
public val CheckedShape: Shape

Default shape for ToggleButton and IconToggleButton in the checked state.

Functions

contentPadding

@Composable
public fun contentPadding(buttonSize: ButtonSize): PaddingValues

Default content padding used for a ToggleButton with the specified buttonSize.

shape

@Composable
public fun shape(
    checked: Boolean,
    checkedShape: Shape = CheckedShape,
    uncheckedShape: Shape = GlimmerTheme.shapes.large,
): Shape

Chooses a Shape based on the checked state and can be used to override the default Glimmer button shapes. Note that it simply switches shapes without animation.

If you require an animated version, please refer to ToggleButtonDefaults.animateShape, which uses default Glimmer animations and shapes, or consider creating a custom animated shape.

Parameters

checked whether the button is in the checked state
checkedShape the shape of the button when it is checked
uncheckedShape the shape of the button when it is unchecked

animateShape

@Composable
public fun animateShape(checked: Boolean): Shape

Provides a Shape that uses the default Glimmer shapes for buttons and animates transitions between states. If you require an animated transition between your own custom shapes, please consider creating a custom animated shape.

Parameters

checked whether the button is in the checked state

colors

@Composable
public fun colors(
    backgroundColor: Color = GlimmerTheme.colors.surface,
    checkedBackgroundColor: Color = GlimmerTheme.colors.outline,
    contentColor: Color = calculateContentColor(backgroundColor),
    checkedContentColor: Color = calculateContentColor(checkedBackgroundColor),
): ToggleButtonColors

Creates ToggleButtonColors with default values for a ToggleButton.

Parameters

backgroundColor the background color when the button is unchecked
checkedBackgroundColor the background color when the button is checked
contentColor the content color when the button is unchecked
checkedContentColor the content color when the button is checked

Last updated: