State of Compose 2023 results are in! Click here to learn more

← Back to Material Compose

FilterChip

Component
in
Material
. Since 1.2.0

Overview

Code Examples

<a href="https://material.io/components/chips#filter-chips" class="external" target="_blank">Material Design filter chip</a>.

Filter chips use tags or descriptive words to filter a collection. They are a good alternative to toggle buttons or checkboxes.

Overloads

FilterChip

@ExperimentalMaterialApi
@Composable
fun FilterChip(
    selected: Boolean,
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
    shape: Shape = MaterialTheme.shapes.small.copy(CornerSize(percent = 50)),
    border: BorderStroke? = null,
    colors: SelectableChipColors = ChipDefaults.filterChipColors(),
    leadingIcon: @Composable (() -> Unit)? = null,
    selectedIcon: @Composable (() -> Unit)? = null,
    trailingIcon: @Composable (() -> Unit)? = null,
    content: @Composable RowScope.() -> Unit
)

Parameters

NameDescription
selectedboolean state for this chip: either it is selected or not
onClickwill be called when the user clicks the chip
modifierModifier to be applied to the chip
enabledcontrols the enabled state of the chip. When false, this chip will not be clickable
interactionSourcethe MutableInteractionSource representing the stream of Interactions for this Chip. You can create and pass in your own remembered MutableInteractionSource if you want to observe Interactions and customize the appearance / behavior of this chip in different Interactions.
shapedefines the chip's shape as well as its shadow
borderborder to draw around the chip
colorsSelectableChipColors that will be used to resolve the background and content color for this chip in different states. See ChipDefaults.filterChipColors.
leadingIconOptional icon at the start of the chip, preceding the content text.
selectedIconIcon used to indicate a chip's selected state, it is commonly a Icons.Filled.Done. By default, if a leading icon is also provided, the leading icon will be obscured by a circle overlay and then the selected icon.
trailingIconOptional icon at the end of the chip, following the content text. Filter chips commonly do not display any trailing icon.
contentthe content of this chi