androidx.compose.material3
FilterChip
Composable function
One of the chip types. It works like AssistChip. Only the parameters that differ are described here.
A chip that turns on and off, like a filter in a search.

var vegan by remember { mutableStateOf(true) }
var spicy by remember { mutableStateOf(false) }
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
FilterChip(
selected = vegan,
onClick = { vegan = !vegan },
label = { Text("Vegan") },
leadingIcon = if (vegan) {
{ Icon(Icons.Filled.Done, null, Modifier.size(FilterChipDefaults.IconSize)) }
} else null,
)
FilterChip(selected = spicy, onClick = { spicy = !spicy }, label = { Text("Spicy") })
}
Basic
Takes one shape.
@Composable
fun FilterChip(
selected: Boolean,
onClick: () -> Unit,
label: @Composable () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
leadingIcon: @Composable (() -> Unit)? = null,
trailingIcon: @Composable (() -> Unit)? = null,
shape: Shape = FilterChipDefaults.shape,
colors: SelectableChipColors = FilterChipDefaults.filterChipColors(),
elevation: SelectableChipElevation? = FilterChipDefaults.filterChipElevation(),
border: BorderStroke? = FilterChipDefaults.filterChipBorder(enabled, selected),
horizontalArrangement: Arrangement.Horizontal = FilterChipDefaults.horizontalArrangement(),
contentPadding: PaddingValues = FilterChipDefaults.ContentPadding,
interactionSource: MutableInteractionSource? = null,
)
selected: BooleanRequired
selected: BooleanRequiredWhether the chip is selected. Only on FilterChip and InputChip. You keep this state yourself.

var vegan by remember { mutableStateOf(true) }
var spicy by remember { mutableStateOf(false) }
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
FilterChip(
selected = vegan,
onClick = { vegan = !vegan },
label = { Text("Vegan") },
leadingIcon = if (vegan) {
{ Icon(Icons.Filled.Done, null, Modifier.size(FilterChipDefaults.IconSize)) }
} else null,
)
FilterChip(selected = spicy, onClick = { spicy = !spicy }, label = { Text("Spicy") })
}
colors: SelectableChipColorsOptional
colors: SelectableChipColorsOptionalDefault: FilterChipDefaults.filterChipColors()
Sets the container, label and icon colors.
Make one with the chip's defaults object, for example FilterChipDefaults.filterChipColors.
elevation: SelectableChipElevation?Optional
elevation: SelectableChipElevation?OptionalDefault: FilterChipDefaults.filterChipElevation()
Sets the shadow height. Default: flat. Use the elevated… functions in the defaults object for a raised chip.
Defaults that differ from AssistChip:
shape=FilterChipDefaults.shapeborder=FilterChipDefaults.filterChipBorder(enabled, selected)horizontalArrangement=FilterChipDefaults.horizontalArrangement()contentPadding=FilterChipDefaults.ContentPadding
Same as in AssistChip: onClick, label, modifier, enabled, leadingIcon, trailingIcon, shape, border, horizontalArrangement, contentPadding, interactionSource.
Expressive
Takes shapes: separate shapes for rest, selected and pressed.
@Composable
fun FilterChip(
selected: Boolean,
onClick: () -> Unit,
label: @Composable () -> Unit,
shapes: ChipShapes,
modifier: Modifier = Modifier,
enabled: Boolean = true,
leadingIcon: @Composable (() -> Unit)? = null,
trailingIcon: @Composable (() -> Unit)? = null,
colors: SelectableChipColors = FilterChipDefaults.tonalFilterChipColors(),
elevation: SelectableChipElevation? = FilterChipDefaults.filterChipElevation(),
border: BorderStroke? = FilterChipDefaults.filterChipBorder(enabled, selected),
horizontalArrangement: Arrangement.Horizontal = FilterChipDefaults.horizontalArrangement(leadingIcon != null, trailingIcon != null),
contentPadding: PaddingValues = FilterChipDefaults.ContentPadding,
interactionSource: MutableInteractionSource? = null,
)
shapes: ChipShapesRequiredSince 1.12
shapes: ChipShapesRequiredSince 1.12Sets shapes for rest, selected and pressed. Takes a ChipShapes.
Defaults that differ from AssistChip:
border=FilterChipDefaults.filterChipBorder(enabled, selected)horizontalArrangement=FilterChipDefaults.horizontalArrangement(leadingIcon != null, trailingIcon != null)contentPadding=FilterChipDefaults.ContentPadding
Same as above: selected, colors, elevation.
Same as in AssistChip: onClick, label, modifier, enabled, leadingIcon, trailingIcon, border, horizontalArrangement, contentPadding, interactionSource.
Chip types
AssistChipFilterChipInputChipSuggestionChipElevatedAssistChipElevatedFilterChipElevatedSuggestionChip
See also
AssistChipDefaults: default values and helper functions forFilterChip.