Chips

Compact elements for filters, assistance, entered data and suggestions.

When to use

Assist chips start an action related to the current context. Filter chips narrow a collection and keep their selected state. Input chips represent entered data such as a tag and can be removed. Suggestion chips offer replies or next steps.

Chips are most useful in rows. Let the row wrap or scroll, and keep labels short.

Playground

The interactive page has a playground with live property controls for this component and generated code.

Examples

Filter chips

Multiple selection.

val options = listOf("Vegan", "Gluten free", "Low sugar")
var selected by remember { mutableStateOf(setOf("Vegan")) }

options.forEach { option ->
    val isSelected = option in selected
    FilterChip(
        selected = isSelected,
        onClick = { selected = if (isSelected) selected - option else selected + option },
        label = { Text(option) },
        leadingIcon = if (isSelected) {
            { Icon(Icons.Rounded.Check, contentDescription = null, modifier = Modifier.size(FilterChipDefaults.IconSize)) }
        } else null,
    )
}

Assist and suggestion

AssistChip(
    onClick = {},
    label = { Text("Add to calendar") },
    leadingIcon = { Icon(Icons.Rounded.Event, contentDescription = null, modifier = Modifier.size(AssistChipDefaults.IconSize)) },
)
SuggestionChip(onClick = {}, label = { Text("Try a shorter route") }, icon = { Icon(Icons.Rounded.Lightbulb, contentDescription = null, modifier = Modifier.size(AssistChipDefaults.IconSize)) })

Input chips

Tap to remove.

var tags by remember { mutableStateOf(listOf("Compose", "Material", "Android")) }

tags.forEach { tag ->
    InputChip(
        selected = false,
        onClick = { tags = tags - tag },
        label = { Text(tag) },
        leadingIcon = { Icon(Icons.Rounded.Label, contentDescription = null, modifier = Modifier.size(InputChipIconSize)) },
        trailingIcon = { Icon(Icons.Rounded.Close, contentDescription = "Remove $tag", modifier = Modifier.size(InputChipIconSize)) },
    )
}

Parameters

NameTypeDefaultDescription
selectedBooleanFilter and input chips. Whether the chip is selected.
onClick() -> UnitCalled on click.
label@Composable () -> UnitChip text.
leadingIcon / trailingIcon@Composable (() -> Unit)?nullOptional icons. Suggestion chips use icon.
elevationChipElevation?defaultUse the elevated variants for chips over images.

Guidelines

Do:

Don't:

Accessibility

Related components