ChipDefaults
object ChipDefaults
Contains the default values used by Chip
Summary
Public functions |
|
|---|---|
ChipColors |
@ComposableCreates a |
ChipBorder |
@ComposableCreates a default (no border) |
ChipColors |
@ComposableCreates a |
ChipColors |
@ExperimentalWearMaterialApiCreates a |
ChipColors |
@ComposableCreates a |
ChipColors |
@ComposableCreates a |
ChipBorder |
@ComposableCreates a |
ChipColors |
@ComposableCreates a |
ChipColors |
@ComposableCreates a |
ChipColors |
@ComposableCreates a |
Public properties |
|
|---|---|
Dp |
|
Dp |
|
PaddingValues |
The default content padding used by |
Dp |
The height applied for the |
Dp |
|
PaddingValues |
The default padding to be provided around a |
Dp |
|
PaddingValues |
The default content padding used by |
Dp |
The default height applied for the |
Dp |
The default size of the icon when used inside a |
Dp |
The size of the icon when used inside a Large "Avatar" |
Dp |
The size of the icon when used inside a "Compact" |
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 |
secondaryContentColor: Color = contentColor |
The secondary content color of this |
iconColor: Color = contentColor |
The icon color of this |
chipBorder
@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 |
disabledBorderStroke: BorderStroke? = null |
The border to use for this |
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 |
contentColor: Color = contentColorFor(backgroundColor) |
The content color of this |
secondaryContentColor: Color = contentColor |
The content color of this |
iconColor: Color = contentColor |
The content color of this |
disabledBackgroundColor: Color = backgroundColor.copy(alpha = ContentAlpha.disabled) |
The background color of this |
disabledContentColor: Color = contentColor.copy(alpha = ContentAlpha.disabled) |
The content color of this |
disabledSecondaryContentColor: Color = secondaryContentColor.copy(alpha = ContentAlpha.disabled) |
The content color of this |
disabledIconColor: Color = iconColor.copy(alpha = ContentAlpha.disabled) |
The content color of this |
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 |
contentColor: Color |
The content color of this |
secondaryContentColor: Color |
The content color of this |
iconColor: Color |
The content color of this |
disabledBackgroundPainter: Painter |
The background painter of this |
disabledContentColor: Color |
The content color of this |
disabledSecondaryContentColor: Color |
The content color of this |
disabledIconColor: Color |
The content color of this |
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 |
endBackgroundColor: Color = MaterialTheme.colors.surface
.copy(alpha = 0f)
.compositeOver(MaterialTheme.colors.surface) |
The background color used at the end of the gradient of this |
contentColor: Color = contentColorFor(endBackgroundColor) |
The content color of this |
secondaryContentColor: Color = contentColor |
The secondary content color of this |
iconColor: Color = contentColor |
The icon color of this |
gradientDirection: LayoutDirection = LocalLayoutDirection.current |
Whether the chips gradient should be start to end (indicated by |
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 |
|
backgroundImageScrimBrush: Brush = Brush.linearGradient(
colors =
listOf(
MaterialTheme.colors.surface.copy(alpha = 1.0f),
MaterialTheme.colors.surface.copy(alpha = 0f),
)
) |
The |
contentColor: Color = MaterialTheme.colors.onBackground |
The content color of this |
secondaryContentColor: Color = contentColor |
The secondary content color of this |
iconColor: Color = contentColor |
The icon color of this |
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 |
disabledBorderColor: Color = borderColor.copy(alpha = ContentAlpha.disabled) |
The color to use for the border for this |
borderWidth: Dp = 1.dp |
The width to use for the border for this |
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 |
secondaryContentColor: Color = contentColor |
The secondary content color of this |
iconColor: Color = contentColor |
The icon color of this |
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 |
contentColor: Color = contentColorFor(backgroundColor) |
The content color of this |
secondaryContentColor: Color = contentColor |
The secondary content color of this |
iconColor: Color = contentColor |
The icon color of this |
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 |
contentColor: Color = contentColorFor(backgroundColor) |
The content color of this |
secondaryContentColor: Color = contentColor |
The secondary content color of this |
iconColor: Color = contentColor |
The icon color of this |
Public properties
CompactChipContentPadding
val CompactChipContentPadding: PaddingValues
The default content padding used by CompactChip
CompactChipHeight
val CompactChipHeight: Dp
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.
CompactChipTapTargetPadding
val CompactChipTapTargetPadding: PaddingValues
The default padding to be provided around a CompactChip in order to ensure that its tappable area meets minimum UX guidance.
ContentPadding
val ContentPadding: PaddingValues
The default content padding used by Chip
Height
val Height: Dp
The default height applied for the Chip. Note that you can override it by applying Modifier.heightIn directly on Chip.
LargeIconSize
val LargeIconSize: Dp
The size of the icon when used inside a Large "Avatar" Chip.
SmallIconSize
val SmallIconSize: Dp
The size of the icon when used inside a "Compact" Chip.