Chip

fun Chip(selected: Boolean, onClick: () -> Unit, label: String, modifier: Modifier = Modifier, enabled: Boolean = true, icon: @Composable () -> Unit? = null, cornerRadius: Dp = ChipDefaults.CornerRadius, minWidth: Dp = ChipDefaults.MinWidth, minHeight: Dp = ChipDefaults.MinHeight, maxWidth: Dp = ChipDefaults.MaxWidth, colors: ChipColors = ChipDefaults.chipColors(), insideMargin: PaddingValues = ChipDefaults.InsideMargin, interactionSource: MutableInteractionSource? = null, indication: Indication? = null)

A Chip component with COUI style.

A capsule shaped, checkable filter tag mirroring ColorOS's COUIChip in its selection style (Widget.COUI.Chip.Choice): the unselected chip is a translucent gray capsule with a primary label; selecting it fills the capsule with the accent color and flips the label to white. The selected/unselected colors cross-fade with the same critically damped spring COUIChipDrawable.TintAnimation uses, and pressing shrinks the chip while tinting the fill (COUIPressFeedbackHelper + COUIMaskEffectDrawable).

Parameters

selected

Whether the Chip is selected.

onClick

The callback when the Chip is clicked.

label

The text label of the Chip. Single line, ellipsized beyond ChipDefaults.TextMaxWidth.

modifier

The modifier to be applied to the Chip.

enabled

Whether the Chip is enabled.

icon

The optional leading icon of the Chip, laid out in a ChipDefaults.IconSize box. LocalContentColor is provided with the current label color so a default Icon is tinted like COUIChip with chipIconApplyTint enabled.

cornerRadius

The corner radius of the Chip. COUIChip uses a capsule (half of the default 32dp height) drawn on the smooth-corner path.

minWidth

The minimum width of the Chip.

minHeight

The minimum height of the Chip.

maxWidth

The maximum width of the Chip.

colors

The ChipColors of the Chip.

insideMargin

The horizontal padding inside the Chip.

interactionSource

The MutableInteractionSource to be used for the Chip.

indication

The Indication to be used for the Chip. Defaults to null because the COUI press feedback (scale + press tint) is built into the chip itself.