Object

ToggleButtonDefaults

Contains the default values used by ToggleButton.

Source set: Android
public object ToggleButtonDefaults

Contains the default values used by ToggleButton.

Properties

SmallToggleButtonSize

Source set: Android
public val SmallToggleButtonSize: Dp

The recommended size for a small ToggleButton. You can apply this value for the size by overriding Modifier.size directly on ToggleButton.

DefaultToggleButtonSize

Source set: Android
public val DefaultToggleButtonSize: Dp

The default size applied for the ToggleButton. Note that you can override it by applying Modifier.size directly on ToggleButton.

SmallIconSize

Source set: Android
public val SmallIconSize: Dp

The size of an icon when used inside a small-sized ToggleButton.

DefaultIconSize

Source set: Android
public val DefaultIconSize: Dp

The default size of an icon when used inside a default-sized ToggleButton.

DefaultRole

Source set: Android
public val DefaultRole: Role

Role semantics that accessibility services can use to provide more context to users.

Functions

toggleButtonColors

@Composable
public fun toggleButtonColors(
    checkedBackgroundColor: Color = MaterialTheme.colors.primary,
    checkedContentColor: Color = contentColorFor(checkedBackgroundColor),
    disabledCheckedBackgroundColor: Color =
        checkedBackgroundColor.copy(alpha = ContentAlpha.disabled),
    disabledCheckedContentColor: Color = MaterialTheme.colors.background,
    uncheckedBackgroundColor: Color = MaterialTheme.colors.surface,
    uncheckedContentColor: Color = contentColorFor(uncheckedBackgroundColor),
    disabledUncheckedBackgroundColor: Color =
        uncheckedBackgroundColor.copy(alpha = ContentAlpha.disabled),
    disabledUncheckedContentColor: Color =
        uncheckedContentColor.copy(alpha = ContentAlpha.disabled),
): ToggleButtonColors

Creates a ToggleButtonColors that represents the background and content colors used in a ToggleButton. Defaults to primary-styled checked colors and surface-styled unchecked colors.

Parameters

checkedBackgroundColor the background color of this ToggleButton when enabled and checked
checkedContentColor the content color of this ToggleButton when enabled and checked
disabledCheckedBackgroundColor the background color of this ToggleButton when checked and not enabled
disabledCheckedContentColor the content color of this ToggleButton when checked and not enabled
uncheckedBackgroundColor the background color of this ToggleButton when enabled and unchecked
uncheckedContentColor the content color of this ToggleButton when enabled and unchecked
disabledUncheckedBackgroundColor the background color of this ToggleButton when unchecked and not enabled
disabledUncheckedContentColor the content color of this ToggleButton when unchecked and not enabled

Last updated: