FilterChip
Composable Component
Material Design filter chip
Android
@ExperimentalTvMaterial3Api
@Composable
fun FilterChip(
selected: Boolean,
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
onLongClick: (() -> Unit)? = null,
leadingIcon: @Composable (() -> Unit)? = null,
trailingIcon: @Composable (() -> Unit)? = null,
shape: SelectableChipShape = FilterChipDefaults.shape(),
colors: SelectableChipColors = FilterChipDefaults.colors(),
scale: SelectableChipScale = FilterChipDefaults.scale(),
border: SelectableChipBorder = FilterChipDefaults.border(),
glow: SelectableChipGlow = FilterChipDefaults.glow(),
interactionSource: MutableInteractionSource? = null,
content: @Composable () -> Unit
)
Parameters
selected | whether this chip is selected or not |
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 |
onLongClick | callback to be called when the surface is long clicked (long-pressed) |
leadingIcon | optional icon at the start of the chip, preceding the content text |
trailingIcon | optional icon at the end of the chip |
shape | Defines the Chip's shape |
colors | Color to be used on background and content of the chip |
scale | Defines size of the chip relative to its original size |
border | Defines a border around the chip |
glow | Shadow to be shown behind the chip |
interactionSource | an optional hoisted MutableInteractionSource for observing and emitting Interaction s for this chip. You can use this to change the chip's appearance or preview the chip in different states. Note that if null is provided, interactions will still happen internally. |
content | for this chip, ideally a Text composable |
Create your own Component Library
Material Components are meant to be used as is and they do not allow customizations. To build your own Jetpack Compose component library use Compose Unstyled