@ExperimentalMaterialApi
object ChipDefaults
Contains the baseline values used by chips.
Properties
val MinHeight = 32.dp
The min height applied for a chip. Note that you can override it by applying Modifier.height directly on a chip.
val outlinedBorder: BorderStroke
The border used by all types of outlined chips
const val LeadingIconOpacity = 0.54f
The color opacity used for chip's leading icon color
const val ContentOpacity = 0.87f
The color opacity used for chip's content color
const val OutlinedBorderOpacity = 0.12f
The color opacity used for the outlined chip's border color
val OutlinedBorderSize = 1.dp
The outlined chip's border size
val LeadingIconSize = 20.dp
The size of a chip's leading icon
val SelectedIconSize = 18.dp
The size of a standalone selected icon
Functions
chipColors
@Composable
fun chipColors(
backgroundColor: Color =
MaterialTheme.colors.onSurface
.copy(alpha = SurfaceOverlayOpacity)
.compositeOver(MaterialTheme.colors.surface),
contentColor: Color = MaterialTheme.colors.onSurface.copy(alpha = ContentOpacity),
leadingIconContentColor: Color = contentColor.copy(alpha = LeadingIconOpacity),
disabledBackgroundColor: Color =
MaterialTheme.colors.onSurface
.copy(alpha = ContentAlpha.disabled * SurfaceOverlayOpacity)
.compositeOver(MaterialTheme.colors.surface),
disabledContentColor: Color =
contentColor.copy(alpha = ContentAlpha.disabled * ContentOpacity),
disabledLeadingIconContentColor: Color =
leadingIconContentColor.copy(alpha = ContentAlpha.disabled * LeadingIconOpacity),
): ChipColors
Creates a ChipColors that represents the default background and content colors used in a filled Chip.
Parameters
| backgroundColor | the background color of this chip when enabled |
| contentColor | the content color of this chip when enabled, there is a separate param for icon colors |
| leadingIconContentColor | the color of this chip's start icon when enabled |
| disabledBackgroundColor | the background color of this chip when not enabled |
| disabledContentColor | the content color of this chip when not enabled |
| disabledLeadingIconContentColor | the color of this chip's start icon when not enabled |
outlinedChipColors
@Composable
fun outlinedChipColors(
backgroundColor: Color = MaterialTheme.colors.surface,
contentColor: Color = MaterialTheme.colors.onSurface.copy(alpha = ContentOpacity),
leadingIconContentColor: Color = contentColor.copy(alpha = LeadingIconOpacity),
disabledBackgroundColor: Color = backgroundColor,
disabledContentColor: Color =
contentColor.copy(alpha = ContentAlpha.disabled * ContentOpacity),
disabledLeadingIconContentColor: Color =
leadingIconContentColor.copy(alpha = ContentAlpha.disabled * LeadingIconOpacity),
): ChipColors
Creates a ChipColors that represents the default background and content colors used in an outlined Chip.
Parameters
| backgroundColor | the background color of this chip when enabled |
| contentColor | the content color of this chip when enabled, there is a separate param for icon colors |
| leadingIconContentColor | the leading icon content color of this chip when enabled |
| disabledBackgroundColor | the background color of this chip when not enabled |
| disabledContentColor | the content color of this chip when not enabled |
| disabledLeadingIconContentColor | the color of this chip's start icon when not enabled |
filterChipColors
@Composable
fun filterChipColors(
backgroundColor: Color =
MaterialTheme.colors.onSurface
.copy(alpha = SurfaceOverlayOpacity)
.compositeOver(MaterialTheme.colors.surface),
contentColor: Color = MaterialTheme.colors.onSurface.copy(alpha = ContentOpacity),
leadingIconColor: Color = contentColor.copy(LeadingIconOpacity),
disabledBackgroundColor: Color =
MaterialTheme.colors.onSurface
.copy(alpha = ContentAlpha.disabled * SurfaceOverlayOpacity)
.compositeOver(MaterialTheme.colors.surface),
disabledContentColor: Color =
contentColor.copy(alpha = ContentAlpha.disabled * ContentOpacity),
disabledLeadingIconColor: Color =
leadingIconColor.copy(alpha = ContentAlpha.disabled * LeadingIconOpacity),
selectedBackgroundColor: Color =
MaterialTheme.colors.onSurface
.copy(alpha = SurfaceOverlayOpacity)
.compositeOver(backgroundColor),
selectedContentColor: Color =
MaterialTheme.colors.onSurface
.copy(alpha = SelectedOverlayOpacity)
.compositeOver(contentColor),
selectedLeadingIconColor: Color =
MaterialTheme.colors.onSurface
.copy(alpha = SelectedOverlayOpacity)
.compositeOver(leadingIconColor),
): SelectableChipColors
Creates a SelectableChipColors that represents the default background and content colors used in a filled FilterChip.
Parameters
| backgroundColor | the background color of this chip when enabled |
| contentColor | the content color of this chip when enabled |
| leadingIconColor | the color of this chip's start icon when enabled |
| disabledBackgroundColor | the background color of this chip when not enabled |
| disabledContentColor | the content color of this chip when not enabled |
| disabledLeadingIconColor | the color of this chip's start icon when not enabled |
| selectedBackgroundColor | the background color of this chip when selected |
| selectedContentColor | the content color of this chip when selected |
| selectedLeadingIconColor | the color of this chip's start icon when selected |
outlinedFilterChipColors
@Composable
fun outlinedFilterChipColors(
backgroundColor: Color = MaterialTheme.colors.surface,
contentColor: Color = MaterialTheme.colors.onSurface.copy(ContentOpacity),
leadingIconColor: Color = contentColor.copy(LeadingIconOpacity),
disabledBackgroundColor: Color = backgroundColor,
disabledContentColor: Color =
contentColor.copy(alpha = ContentAlpha.disabled * ContentOpacity),
disabledLeadingIconColor: Color =
leadingIconColor.copy(alpha = ContentAlpha.disabled * LeadingIconOpacity),
selectedBackgroundColor: Color =
MaterialTheme.colors.onSurface
.copy(alpha = SelectedOverlayOpacity)
.compositeOver(backgroundColor),
selectedContentColor: Color =
MaterialTheme.colors.onSurface
.copy(alpha = SelectedOverlayOpacity)
.compositeOver(contentColor),
selectedLeadingIconColor: Color =
MaterialTheme.colors.onSurface
.copy(alpha = SelectedOverlayOpacity)
.compositeOver(leadingIconColor),
): SelectableChipColors
Creates a ChipColors that represents the default background and content colors used in a selectable outlined FilterChip.
Parameters
| backgroundColor | the background color of this chip when enabled |
| contentColor | the content color of this chip when enabled |
| leadingIconColor | the color of this chip's start icon when enabled |
| disabledBackgroundColor | the background color of this chip when not enabled |
| disabledContentColor | the content color of this chip when not enabled |
| disabledLeadingIconColor | the color of this chip's start icon when not enabled |
| selectedBackgroundColor | the background color of this chip when selected |
| selectedContentColor | the content color of this chip when selected |
| selectedLeadingIconColor | the color of this chip's start icon when selected |