androidx.compose.material3

AssistChip

Composable function

Chips are small, compact elements. There are four types, each for a different job:

Assist, filter, input and suggestion
Assist, filter, input and suggestion
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
    AssistChip(onClick = {}, label = { Text("Assist") })
    FilterChip(selected = true, onClick = {}, label = { Text("Filter") })
    InputChip(selected = false, onClick = {}, label = { Text("Input") })
    SuggestionChip(onClick = {}, label = { Text("Suggestion") })
}

Assist, filter and suggestion chips also come in an elevated version with a shadow, for chips on top of images or busy backgrounds.

Parameters

@Composable
fun AssistChip(
    onClick: () -> Unit,
    label: @Composable () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    leadingIcon: @Composable (() -> Unit)? = null,
    trailingIcon: @Composable (() -> Unit)? = null,
    shape: Shape = AssistChipDefaults.shape,
    colors: ChipColors = AssistChipDefaults.assistChipColors(),
    elevation: ChipElevation? = AssistChipDefaults.assistChipElevation(),
    border: BorderStroke? = AssistChipDefaults.assistChipBorder(enabled),
    horizontalArrangement: Arrangement.Horizontal = AssistChipDefaults.horizontalArrangement(),
    contentPadding: PaddingValues = AssistChipDefaults.ContentPadding,
    interactionSource: MutableInteractionSource? = null,
)

onClick: () -> UnitRequired

Called when the chip is clicked. For a filter chip, flip your state here.

label: @Composable () -> UnitRequired

The text of the chip. Usually one short Text.

modifier: ModifierOptional

Default: Modifier

Changes size, padding, or position of the chip. See the Modifier guide.

enabled: BooleanOptional

Default: true

Set to false to make the chip gray and not clickable.

Disabled
Disabled
AssistChip(onClick = {}, label = { Text("Not available") }, enabled = false)

leadingIcon: @Composable (() -> Unit)?Optional

Default: null

An icon before the label. Size it with IconSize from the chip's defaults object, for example AssistChipDefaults.IconSize. A filter chip often shows a checkmark here only while selected.

Assist chip with an icon
Assist chip with an icon
AssistChip(
    onClick = {},
    label = { Text("Add to calendar") },
    leadingIcon = {
        Icon(Icons.Filled.DateRange, contentDescription = null, Modifier.size(AssistChipDefaults.IconSize))
    },
)

trailingIcon: @Composable (() -> Unit)?Optional

Default: null

An icon after the label. On input chips, usually a close icon to remove the item.

shape: ShapeOptional

Default: AssistChipDefaults.shape

Sets the outline. Default: the theme's small shape (8 dp corners). See the Shapes guide.

colors: ChipColorsOptional

Default: AssistChipDefaults.assistChipColors()

Sets the container, label and icon colors. Make one with the chip's defaults object, for example FilterChipDefaults.filterChipColors.

elevation: ChipElevation?Optional

Default: AssistChipDefaults.assistChipElevation()

Sets the shadow height. Default: flat. Use the elevated… functions in the defaults object for a raised chip.

border: BorderStroke?Optional

Default: AssistChipDefaults.assistChipBorder(enabled)

Draws an outline. Unselected chips have one by default. Selected filter chips do not.

horizontalArrangement: Arrangement.HorizontalOptionalSince 1.11

Default: AssistChipDefaults.horizontalArrangement()

Space between the icons and the label.

contentPadding: PaddingValuesOptionalSince 1.11

Default: AssistChipDefaults.ContentPadding

Space between the edge of the chip and its content.

interactionSource: MutableInteractionSource?Optional

Default: null

Lets you observe or control press, hover and focus states. Leave it null unless your code must react to them. See InteractionSource.

Chip types

See also