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

← Back to Material 3 Compose

InputChip

Component
in
Material 3
. Since 1.0.0

Overview

Code Examples

Video

<a href="https://m3.material.io/components/chips/overview" class="external" target="_blank">Material Design input chip</a>.

Chips help people enter information, make selections, filter content, or trigger actions. Chips can show multiple interactive elements together in the same area, such as a list of selectable movie times, or a series of email contacts.

Input chips represent discrete pieces of information entered by a user.

!Input chip image(https://developer.android.com/images/reference/androidx/compose/material3/input-chip.png)

An Input Chip can have a leading icon or an avatar at its start. In case both are provided, the avatar will take precedence and will be displayed.

Example of an InputChip with a trailing icon:

Overloads

InputChip

@ExperimentalMaterial3Api
@Composable
fun InputChip(
    selected: Boolean,
    onClick: () -> Unit,
    label: @Composable () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    leadingIcon: @Composable (() -> Unit)? = null,
    avatar: @Composable (() -> Unit)? = null,
    trailingIcon: @Composable (() -> Unit)? = null,
    shape: Shape = InputChipDefaults.shape,
    colors: SelectableChipColors = InputChipDefaults.inputChipColors(),
    elevation: SelectableChipElevation? = InputChipDefaults.inputChipElevation(),
    border: SelectableChipBorder? = InputChipDefaults.inputChipBorder(),
    interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
)

Parameters

NameDescription
selectedwhether this chip is selected or not
onClickcalled when this chip is clicked
labeltext label for this chip
modifierthe Modifier to be applied to this chip
enabledcontrols 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.
leadingIconoptional icon at the start of the chip, preceding the label text
avataroptional avatar at the start of the chip, preceding the label text
trailingIconoptional icon at the end of the chip
shapedefines the shape of this chip's container, border (when border is not null), and shadow (when using elevation)
colorsChipColors that will be used to resolve the colors used for this chip in different states. See InputChipDefaults.inputChipColors.
elevationChipElevation used to resolve the elevation for this chip in different states. This controls the size of the shadow below the chip. Additionally, when the container color is ColorScheme.surface, this controls the amount of primary color applied as an overlay. See InputChipDefaults.inputChipElevation.
borderthe border to draw around the container of this chip. Pass null for no border. See InputChipDefaults.inputChipBorder.
interactionSourcethe MutableInteractionSource representing the stream of Interactions for this chip. You can create and pass in your own remembered instance to observe Interactions and customize the appearance / behavior of this chip in different states