ToggleButtonDefaults


object ToggleButtonDefaults


Contains the default values used by ToggleButton.

Summary

Public functions

ToggleButtonColors
@Composable
toggleButtonColors(
    checkedBackgroundColor: Color,
    checkedContentColor: Color,
    disabledCheckedBackgroundColor: Color,
    disabledCheckedContentColor: Color,
    uncheckedBackgroundColor: Color,
    uncheckedContentColor: Color,
    disabledUncheckedBackgroundColor: Color,
    disabledUncheckedContentColor: Color
)

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

Public properties

Dp

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

Role

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

Dp

The default size applied for the ToggleButton.

Dp

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

Dp

The recommended size for a small ToggleButton.

Public functions

toggleButtonColors

@Composable
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: Color = MaterialTheme.colors.primary

the background color of this ToggleButton when enabled and checked

checkedContentColor: Color = contentColorFor(checkedBackgroundColor)

the content color of this ToggleButton when enabled and checked

disabledCheckedBackgroundColor: Color = checkedBackgroundColor.copy(alpha = ContentAlpha.disabled)

the background color of this ToggleButton when checked and not enabled

disabledCheckedContentColor: Color = MaterialTheme.colors.background

the content color of this ToggleButton when checked and not enabled

uncheckedBackgroundColor: Color = MaterialTheme.colors.surface

the background color of this ToggleButton when enabled and unchecked

uncheckedContentColor: Color = contentColorFor(uncheckedBackgroundColor)

the content color of this ToggleButton when enabled and unchecked

disabledUncheckedBackgroundColor: Color = uncheckedBackgroundColor.copy(alpha = ContentAlpha.disabled)

the background color of this ToggleButton when unchecked and not enabled

disabledUncheckedContentColor: Color = uncheckedContentColor.copy(alpha = ContentAlpha.disabled)

the content color of this ToggleButton when unchecked and not enabled

Public properties

DefaultIconSize

Added in 1.0.0
val DefaultIconSizeDp

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

DefaultRole

Added in 1.2.0
val DefaultRoleRole

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

DefaultToggleButtonSize

Added in 1.0.0
val DefaultToggleButtonSizeDp

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

SmallIconSize

Added in 1.0.0
val SmallIconSizeDp

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

SmallToggleButtonSize

Added in 1.0.0
val SmallToggleButtonSizeDp

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