Chip

fun Chip(onClick: () -> Unit, modifier: Modifier = Modifier, onClose: () -> Unit? = null, onCloseLabel: String? = null, intent: ChipIntent = ChipIntent.Basic, style: ChipStyles = ChipStyles.Outlined, enabled: Boolean = true, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, leadingIcon: @Composable () -> Unit? = null, trailingIcon: @Composable () -> Unit? = null, content: @Composable RowScope.() -> Unit?)

Chips help users quickly recognize an important information that has been entered by them, trigger actions, make selections, or filter content.

Parameters

style

one of ChipStyles that defines chips background and border.

onClose

when provided will add the closing indicator and make it clickable. note that adding it will require onCloseLabel to be provided as well.

onCloseLabel

semantic / accessibility label for the onClose action. It should describe to the user what will happen if onClose is tapped.

intent

The ChipIntent colors that will be used for the content and background of this chip in different states.

onClick

called when this chip is clicked

modifier

the Modifier to be applied to this chip

enabled

controls the enabled state of this chip. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

interactionSource

the MutableInteractionSource representing the stream of Interactions for this chip. You can create and pass in your own remembered instance to observe Interactions and customize the appearance / behavior of this chip in different states.

content

a Composable to set as the chip's custom content.


fun Chip(onClick: () -> Unit, text: String?, modifier: Modifier = Modifier, onClose: () -> Unit? = null, onCloseLabel: String? = null, intent: ChipIntent = ChipIntent.Basic, style: ChipStyles = ChipStyles.Outlined, enabled: Boolean = true, leadingIcon: SparkIcon? = null, contentDescription: String? = null, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

Chips help users quickly recognize an important information that has been entered by them, trigger actions, make selections, or filter content.

Parameters

onClick

called when this chip is clicked

text

label for this chip, set null if no label is needed

modifier

the Modifier to be applied to this chip

onClose

when provided will add the closing indicator and make it clickable. note that adding it will require onCloseLabel to be provided as well.

onCloseLabel

semantic / accessibility label for the onClose action. It should describe to the user what will happen if onClose is tapped.

intent

The ChipIntent colors that will be used for the content and background of this chip in different states.

style

one of ChipStyles that defines chips background and border.

enabled

controls the enabled state of this chip. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

leadingIcon

optional icon at the start of the chip, preceding the text

contentDescription

text used by accessibility services to describe what this icon represents. This should always be provided unless this icon is used for decorative purposes, and does not represent a meaningful action that a user can take. This text should be localized, such as by using androidx.compose.ui.res.stringResource or similar.

interactionSource

the MutableInteractionSource representing the stream of Interactions for this chip. You can create and pass in your own remembered instance to observe Interactions and customize the appearance / behavior of this chip in different states.