ChipDefaults

object ChipDefaults


Contains the default values used by Chip

Summary

Public functions

@Composable ChipColors
childChipColors(
    contentColor: Color,
    secondaryContentColor: Color,
    iconTintColor: Color
)

Creates a ChipColors that represents the default background (transparent) and content colors for a child Chip.

@Composable ChipColors
chipColors(
    backgroundColor: Color,
    contentColor: Color,
    secondaryContentColor: Color,
    iconTintColor: Color,
    disabledBackgroundColor: Color,
    disabledContentColor: Color,
    disabledSecondaryContentColor: Color,
    disabledIconTintColor: Color
)

Creates a ChipColors that represents the default background and content colors used in a Chip.

@Composable ChipColors
gradientBackgroundChipColors(
    startBackgroundColor: Color,
    endBackgroundColor: Color,
    contentColor: Color,
    secondaryContentColor: Color,
    iconTintColor: Color,
    gradientDirection: LayoutDirection
)

Creates a ChipColors that represents the background and content colors for a primary Chip with a linear gradient for a background.

@Composable ChipColors
imageBackgroundChipColors(
    backgroundImagePainter: Painter,
    backgroundImageScrimBrush: Brush,
    contentColor: Color,
    secondaryContentColor: Color,
    iconTintColor: Color
)

Creates a ChipColors for an image background Chip.

@Composable ChipColors
primaryChipColors(
    backgroundColor: Color,
    contentColor: Color,
    secondaryContentColor: Color,
    iconTintColor: Color
)

Creates a ChipColors that represents the default background and content colors for a primary Chip.

@Composable ChipColors
secondaryChipColors(
    backgroundColor: Color,
    contentColor: Color,
    secondaryContentColor: Color,
    iconTintColor: Color
)

Creates a ChipColors that represents the default background and content colors for a secondary Chip.

Public properties

PaddingValues

The default content padding used by Chip

Dp

The default size of the icon when used inside a Chip.

Dp

The size of the icon when used inside a Large "Avatar" Chip.

Dp

The size of the icon when used inside a "Compact" Chip.

Public functions

childChipColors

@Composable
fun childChipColors(
    contentColor: Color = MaterialTheme.colors.onSurface,
    secondaryContentColor: Color = contentColor,
    iconTintColor: Color = contentColor
): @Composable ChipColors

Creates a ChipColors that represents the default background (transparent) and content colors for a child Chip. Child chips have a transparent background and use a default content color of Colors.onSurface.

If a chip is disabled then the color will have an alpha(ContentAlpha.disabled) value applied.

Parameters
contentColor: Color = MaterialTheme.colors.onSurface

The content color of this Chip when enabled

secondaryContentColor: Color = contentColor

The secondary content color of this Chip when enabled, used for secondaryLabel content

iconTintColor: Color = contentColor

The icon tint color of this Chip when enabled, used for icon content

chipColors

@Composable
fun chipColors(
    backgroundColor: Color = MaterialTheme.colors.primary,
    contentColor: Color = contentColorFor(backgroundColor),
    secondaryContentColor: Color = contentColor,
    iconTintColor: Color = contentColor,
    disabledBackgroundColor: Color = backgroundColor.copy(alpha = ContentAlpha.disabled),
    disabledContentColor: Color = contentColor.copy(alpha = ContentAlpha.disabled),
    disabledSecondaryContentColor: Color = secondaryContentColor.copy(alpha = ContentAlpha.disabled),
    disabledIconTintColor: Color = iconTintColor.copy(alpha = ContentAlpha.disabled)
): @Composable ChipColors

Creates a ChipColors that represents the default background and content colors used in a Chip.

Parameters
backgroundColor: Color = MaterialTheme.colors.primary

The background color of this Chip when enabled

contentColor: Color = contentColorFor(backgroundColor)

The content color of this Chip when enabled

secondaryContentColor: Color = contentColor

The content color of this Chip when enabled

iconTintColor: Color = contentColor

The content color of this Chip when enabled

disabledBackgroundColor: Color = backgroundColor.copy(alpha = ContentAlpha.disabled)

The background color of this Chip when not enabled

disabledContentColor: Color = contentColor.copy(alpha = ContentAlpha.disabled)

The content color of this Chip when not enabled

disabledSecondaryContentColor: Color = secondaryContentColor.copy(alpha = ContentAlpha.disabled)

The content color of this Chip when not enabled

disabledIconTintColor: Color = iconTintColor.copy(alpha = ContentAlpha.disabled)

The content color of this Chip when not enabled

gradientBackgroundChipColors

@Composable
fun gradientBackgroundChipColors(
    startBackgroundColor: Color = MaterialTheme.colors.primary.copy(alpha = 0.5f),
    endBackgroundColor: Color = MaterialTheme.colors.surface,
    contentColor: Color = contentColorFor(endBackgroundColor),
    secondaryContentColor: Color = contentColor,
    iconTintColor: Color = contentColor,
    gradientDirection: LayoutDirection = LocalLayoutDirection.current
): @Composable ChipColors

Creates a ChipColors that represents the background and content colors for a primary Chip with a linear gradient for a background. The gradient will be between startBackgroundColor and endBackgroundColor. Gradient backgrounds are typically used for chips showing an on-going activity, such as a music track that is playing.

Gradient background chips should have a content color that contrasts with the background gradient. If a chip is disabled then the color will have an alpha(ContentAlpha.disabled) value applied.

Parameters
startBackgroundColor: Color = MaterialTheme.colors.primary.copy(alpha = 0.5f)

The background color used at the start of the gradient of this Chip when enabled

endBackgroundColor: Color = MaterialTheme.colors.surface

The background color used at the end of the gradient of this Chip when enabled

contentColor: Color = contentColorFor(endBackgroundColor)

The content color of this Chip when enabled

secondaryContentColor: Color = contentColor

The secondary content color of this Chip when enabled, used for secondaryLabel content

iconTintColor: Color = contentColor

The icon tint color of this Chip when enabled, used for icon content

gradientDirection: LayoutDirection = LocalLayoutDirection.current

Whether the chips gradient should be start to end (indicated by LayoutDirection.Ltr) or end to start (indicated by LayoutDirection.Rtl).

imageBackgroundChipColors

@Composable
fun imageBackgroundChipColors(
    backgroundImagePainter: Painter,
    backgroundImageScrimBrush: Brush = Brush.linearGradient( colors = listOf( MaterialTheme.colors.surface.copy(alpha = 1.0f), MaterialTheme.colors.surface.copy(alpha = 0f) ) ),
    contentColor: Color = MaterialTheme.colors.onBackground,
    secondaryContentColor: Color = contentColor,
    iconTintColor: Color = contentColor
): @Composable ChipColors

Creates a ChipColors for an image background Chip. Image background chips have an image as the background of the chip typically with a scrim over the image to ensure that the content is visible, and use a default content color of Colors.onBackground.

Parameters
backgroundImagePainter: Painter

The Painter to use to draw the background of the Chip

backgroundImageScrimBrush: Brush = Brush.linearGradient( colors = listOf( MaterialTheme.colors.surface.copy(alpha = 1.0f), MaterialTheme.colors.surface.copy(alpha = 0f) ) )

The Brush to use to paint a scrim over the background image to ensure that any text drawn over the image is legible

contentColor: Color = MaterialTheme.colors.onBackground

The content color of this Chip when enabled

secondaryContentColor: Color = contentColor

The secondary content color of this Chip when enabled, used for secondaryLabel content

iconTintColor: Color = contentColor

The icon tint color of this Chip when enabled, used for icon content

primaryChipColors

@Composable
fun primaryChipColors(
    backgroundColor: Color = MaterialTheme.colors.primary,
    contentColor: Color = contentColorFor(backgroundColor),
    secondaryContentColor: Color = contentColor,
    iconTintColor: Color = contentColor
): @Composable ChipColors

Creates a ChipColors that represents the default background and content colors for a primary Chip. Primary chips have a colored background with a contrasting content color. If a chip is disabled then the color will have an alpha(ContentAlpha.disabled) value applied.

Parameters
backgroundColor: Color = MaterialTheme.colors.primary

The background color of this Chip when enabled

contentColor: Color = contentColorFor(backgroundColor)

The content color of this Chip when enabled

secondaryContentColor: Color = contentColor

The secondary content color of this Chip when enabled, used for secondaryLabel content

iconTintColor: Color = contentColor

The icon tint color of this Chip when enabled, used for icon content

secondaryChipColors

@Composable
fun secondaryChipColors(
    backgroundColor: Color = MaterialTheme.colors.surface,
    contentColor: Color = contentColorFor(backgroundColor),
    secondaryContentColor: Color = contentColor,
    iconTintColor: Color = contentColor
): @Composable ChipColors

Creates a ChipColors that represents the default background and content colors for a secondary Chip. Secondary chips have a muted background with a contrasting content color. If a chip is disabled then the color will have an alpha(ContentAlpha.disabled) value applied.

Parameters
backgroundColor: Color = MaterialTheme.colors.surface

The background color of this Chip when enabled

contentColor: Color = contentColorFor(backgroundColor)

The content color of this Chip when enabled

secondaryContentColor: Color = contentColor

The secondary content color of this Chip when enabled, used for secondaryLabel content

iconTintColor: Color = contentColor

The icon tint color of this Chip when enabled, used for icon content

Public properties

ContentPadding

val ContentPaddingPaddingValues

The default content padding used by Chip

IconSize

val IconSizeDp

The default size of the icon when used inside a Chip.

LargeIconSize

val LargeIconSizeDp

The size of the icon when used inside a Large "Avatar" Chip.

SmallIconSize

val SmallIconSizeDp

The size of the icon when used inside a "Compact" Chip.