ChipDefaults

object ChipDefaults


Contains the default values used by Chip

Summary

Public functions

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

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

ChipBorder
@Composable
chipBorder(
    borderStroke: BorderStroke?,
    disabledBorderStroke: BorderStroke?
)

Creates a default (no border) ChipBorder for a Chip

ChipColors
@Composable
chipColors(
    backgroundColor: Color,
    contentColor: Color,
    secondaryContentColor: Color,
    iconColor: Color,
    disabledBackgroundColor: Color,
    disabledContentColor: Color,
    disabledSecondaryContentColor: Color,
    disabledIconColor: Color
)

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

ChipColors
@ExperimentalWearMaterialApi
chipColors(
    backgroundPainter: Painter,
    contentColor: Color,
    secondaryContentColor: Color,
    iconColor: Color,
    disabledBackgroundPainter: Painter,
    disabledContentColor: Color,
    disabledSecondaryContentColor: Color,
    disabledIconColor: Color
)

Creates a ChipColors where all of the values are explicitly defined.

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

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

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

Creates a ChipColors for an image background Chip.

ChipBorder
@Composable
outlinedChipBorder(
    borderColor: Color,
    disabledBorderColor: Color,
    borderWidth: Dp
)

Creates a ChipBorder for an OutlinedChip

ChipColors
@Composable
outlinedChipColors(
    contentColor: Color,
    secondaryContentColor: Color,
    iconColor: Color
)

Creates a ChipColors for an outline Chip.

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

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

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

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

Public properties

Dp
Dp
PaddingValues

The default content padding used by CompactChip

Dp

The height applied for the CompactChip.

Dp
PaddingValues

The default padding to be provided around a CompactChip in order to ensure that its tappable area meets minimum UX guidance.

Dp
PaddingValues

The default content padding used by Chip

Dp

The default height applied for the 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,
    iconColor: Color = contentColor
): 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 colors 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

iconColor: Color = contentColor

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

chipBorder

Added in 1.1.0
@Composable
fun chipBorder(
    borderStroke: BorderStroke? = null,
    disabledBorderStroke: BorderStroke? = null
): ChipBorder

Creates a default (no border) ChipBorder for a Chip

Parameters
borderStroke: BorderStroke? = null

The border for this Chip when enabled

disabledBorderStroke: BorderStroke? = null

The border to use for this Chip when disabled

chipColors

@Composable
fun chipColors(
    backgroundColor: Color = MaterialTheme.colors.primary,
    contentColor: Color = contentColorFor(backgroundColor),
    secondaryContentColor: Color = contentColor,
    iconColor: Color = contentColor,
    disabledBackgroundColor: Color = backgroundColor.copy(alpha = ContentAlpha.disabled),
    disabledContentColor: Color = contentColor.copy(alpha = ContentAlpha.disabled),
    disabledSecondaryContentColor: Color = secondaryContentColor.copy(alpha = ContentAlpha.disabled),
    disabledIconColor: Color = iconColor.copy(alpha = ContentAlpha.disabled)
): 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

iconColor: 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

disabledIconColor: Color = iconColor.copy(alpha = ContentAlpha.disabled)

The content color of this Chip when not enabled

chipColors

@ExperimentalWearMaterialApi
fun chipColors(
    backgroundPainter: Painter,
    contentColor: Color,
    secondaryContentColor: Color,
    iconColor: Color,
    disabledBackgroundPainter: Painter,
    disabledContentColor: Color,
    disabledSecondaryContentColor: Color,
    disabledIconColor: Color
): ChipColors

Creates a ChipColors where all of the values are explicitly defined.

Parameters
backgroundPainter: Painter

The background painter of this Chip when enabled

contentColor: Color

The content color of this Chip when enabled

secondaryContentColor: Color

The content color of this Chip when enabled

iconColor: Color

The content color of this Chip when enabled

disabledBackgroundPainter: Painter

The background painter of this Chip when not enabled

disabledContentColor: Color

The content color of this Chip when not enabled

disabledSecondaryContentColor: Color

The content color of this Chip when not enabled

disabledIconColor: Color

The content color of this Chip when not enabled

gradientBackgroundChipColors

@Composable
fun gradientBackgroundChipColors(
    startBackgroundColor: Color = MaterialTheme.colors.primary.copy(alpha = 0.5f) .compositeOver(MaterialTheme.colors.surface),
    endBackgroundColor: Color = MaterialTheme.colors.surface.copy(alpha = 0f) .compositeOver(MaterialTheme.colors.surface),
    contentColor: Color = contentColorFor(endBackgroundColor),
    secondaryContentColor: Color = contentColor,
    iconColor: Color = contentColor,
    gradientDirection: LayoutDirection = LocalLayoutDirection.current
): 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 colors will have an alpha(ContentAlpha.disabled) value applied.

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

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

endBackgroundColor: Color = MaterialTheme.colors.surface.copy(alpha = 0f) .compositeOver(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

iconColor: Color = contentColor

The icon 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,
    iconColor: Color = contentColor
): 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

iconColor: Color = contentColor

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

outlinedChipBorder

@Composable
fun outlinedChipBorder(
    borderColor: Color = MaterialTheme.colors.primaryVariant.copy(alpha = 0.6f),
    disabledBorderColor: Color = borderColor.copy(alpha = ContentAlpha.disabled),
    borderWidth: Dp = 1.dp
): ChipBorder

Creates a ChipBorder for an OutlinedChip

Parameters
borderColor: Color = MaterialTheme.colors.primaryVariant.copy(alpha = 0.6f)

The color to use for the border for this OutlinedChip when enabled

disabledBorderColor: Color = borderColor.copy(alpha = ContentAlpha.disabled)

The color to use for the border for this OutlinedChip when disabled

borderWidth: Dp = 1.dp

The width to use for the border for this OutlinedChip

outlinedChipColors

@Composable
fun outlinedChipColors(
    contentColor: Color = MaterialTheme.colors.primary,
    secondaryContentColor: Color = contentColor,
    iconColor: Color = contentColor
): ChipColors

Creates a ChipColors for an outline Chip. Outline chips have a transparent background with a thin border.

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

Parameters
contentColor: Color = MaterialTheme.colors.primary

The content color of this Chip when enabled

secondaryContentColor: Color = contentColor

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

iconColor: Color = contentColor

The icon 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,
    iconColor: Color = contentColor
): 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 colors 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

iconColor: Color = contentColor

The icon 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,
    iconColor: Color = contentColor
): 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 colors 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

iconColor: Color = contentColor

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

Public properties

ChipHorizontalPadding

Added in 1.4.0-alpha04
val ChipHorizontalPaddingDp

ChipVerticalPadding

Added in 1.4.0-alpha04
val ChipVerticalPaddingDp

CompactChipContentPadding

Added in 1.0.0
val CompactChipContentPaddingPaddingValues

The default content padding used by CompactChip

CompactChipHeight

Added in 1.4.0-alpha04
val CompactChipHeightDp

The height applied for the CompactChip. This includes a visible chip height of 32.dp and 8.dp of padding above and below the chip in order to meet accessibility guidelines that request a minimum of 48.dp height and width of tappable area.

Note that you can override it by adjusting Modifier.height and Modifier.padding directly on CompactChip.

CompactChipHorizontalPadding

Added in 1.4.0-alpha04
val CompactChipHorizontalPaddingDp

CompactChipTapTargetPadding

Added in 1.2.0
val CompactChipTapTargetPaddingPaddingValues

The default padding to be provided around a CompactChip in order to ensure that its tappable area meets minimum UX guidance.

CompactChipVerticalPadding

Added in 1.4.0-alpha04
val CompactChipVerticalPaddingDp

ContentPadding

Added in 1.0.0
val ContentPaddingPaddingValues

The default content padding used by Chip

Height

Added in 1.4.0-alpha04
val HeightDp

The default height applied for the Chip. Note that you can override it by applying Modifier.heightIn directly on Chip.

IconSize

Added in 1.0.0
val IconSizeDp

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

LargeIconSize

Added in 1.0.0
val LargeIconSizeDp

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

SmallIconSize

Added in 1.0.0
val SmallIconSizeDp

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