Object

ToggleChipDefaults

Contains the default values used by ToggleChips and SplitToggleChips

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Android
public object ToggleChipDefaults

Contains the default values used by ToggleChips and SplitToggleChips

Functions

toggleChipColors

@Composable
public fun toggleChipColors(
    checkedStartBackgroundColor: Color =
        MaterialTheme.colors.surface
            .copy(alpha = 0f)
            .compositeOver(MaterialTheme.colors.surface),
    checkedEndBackgroundColor: Color =
        MaterialTheme.colors.primary
            .copy(alpha = 0.5f)
            .compositeOver(MaterialTheme.colors.surface),
    checkedContentColor: Color = MaterialTheme.colors.onSurface,
    checkedSecondaryContentColor: Color = MaterialTheme.colors.onSurfaceVariant,
    checkedToggleControlColor: Color = MaterialTheme.colors.secondary,
    uncheckedStartBackgroundColor: Color = MaterialTheme.colors.surface,
    uncheckedEndBackgroundColor: Color = uncheckedStartBackgroundColor,
    uncheckedContentColor: Color = contentColorFor(checkedEndBackgroundColor),
    uncheckedSecondaryContentColor: Color = uncheckedContentColor,
    uncheckedToggleControlColor: Color = uncheckedContentColor,
    gradientDirection: LayoutDirection = LocalLayoutDirection.current,
): ToggleChipColors

Creates a ToggleChipColors for use in a ToggleChip. ToggleChips are expected to have a linear gradient background when checked, similar to a ChipDefaults.gradientBackgroundChipColors and a solid neutral background when not checked (similar to a ChipDefaults.secondaryChipColors)

Parameters

checkedStartBackgroundColor The background color used at the start of the gradient of a ToggleChip when enabled and checked.
checkedEndBackgroundColor The background color used at the end of the gradient of a ToggleChip when enabled and checked.
checkedContentColor The content color of a ToggleChip when enabled and checked.
checkedSecondaryContentColor The secondary content color of this ToggleChip when enabled and checked, used for secondaryLabel content
checkedToggleControlColor The toggle control color of this ToggleChip when enabled and checked, used for toggleControl content
uncheckedStartBackgroundColor The background color used at the start of the gradient of a ToggleChip when enabled and unchecked.
uncheckedEndBackgroundColor The background color used at the end of the gradient of a ToggleChip when enabled and unchecked.
uncheckedContentColor The content color of a ToggleChip when enabled and checked.
uncheckedSecondaryContentColor The secondary content color of this ToggleChip when enabled and unchecked, used for secondaryLabel content
uncheckedToggleControlColor The toggle control color of this ToggleChip when enabled and unchecked.
gradientDirection Whether the chips gradient should be start to end (indicated by LayoutDirection.Ltr) or end to start (indicated by LayoutDirection.Rtl).

splitToggleChipColors

@Composable
public fun splitToggleChipColors(
    backgroundColor: Color = MaterialTheme.colors.surface,
    contentColor: Color = MaterialTheme.colors.onSurface,
    secondaryContentColor: Color = MaterialTheme.colors.onSurfaceVariant,
    checkedToggleControlColor: Color = MaterialTheme.colors.secondary,
    uncheckedToggleControlColor: Color = contentColor,
    splitBackgroundOverlayColor: Color = Color.White.copy(alpha = 0.05f),
): SplitToggleChipColors

Creates a SplitToggleChipColors for use in a SplitToggleChip.

Parameters

backgroundColor The background color of this SplitToggleChip when enabled
contentColor The content color of this SplitToggleChip when enabled.
secondaryContentColor The secondary content color of thisSplitToggleChip when enabled
checkedToggleControlColor The toggle control content color of this SplitToggleChip when enabled.
uncheckedToggleControlColor The toggle control content color of this SplitToggleChip when enabled.
splitBackgroundOverlayColor The color to use to lighten/distinguish the background behind the ToggleControl for a split background chip. A split background chip has two tappable areas, one for the main body of the chip and one for area around the toggle control icon.

switchIcon

public fun switchIcon(checked: Boolean): ImageVector

Creates switch style toggle ImageVectors for use in the toggleControl slot of a ToggleChip or SplitToggleChip. Depending on checked will return either an 'on' (checked) or 'off' (unchecked) switch icon.

Parameters

checked whether the ToggleChip or SplitToggleChip is currently 'on' (checked/true) or 'off' (unchecked/false)

radioIcon

public fun radioIcon(checked: Boolean): ImageVector

Creates a radio button style toggle ImageVectors for use in the toggleControl slot of a ToggleChip or SplitToggleChip. Depending on checked will return either an 'on' (checked) or 'off' (unchecked) radio button icon.

Parameters

checked whether the ToggleChip or SplitToggleChip is currently 'on' (checked/true) or 'off' (unchecked/false)

checkboxIcon

public fun checkboxIcon(checked: Boolean): ImageVector

Creates checkbox style toggle ImageVectors for use in the toggleControl slot of a ToggleChip or SplitToggleChip. Depending on checked will return either an 'on' (ticked/checked) or 'off' (unticked/unchecked) checkbox image.

Parameters

checked whether the ToggleChip or SplitToggleChip is currently 'on' (checked/true) or 'off' (unchecked/false)