Reference version

This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 54).

A Jetpack Compose Chip component for displaying compact elements.

Android

A chip component for displaying compact elements that represent inputs, attributes, or actions.

Installation

Terminal
npx expo install @expo/ui

If you are installing this in an existing React Native app, make sure to install expo in your project.

Usage

import { Chip } from '@expo/ui/jetpack-compose'; // Assist chip with icon <Chip variant="assist" label="Book" leadingIcon="filled.Add" onPress={() => console.log('Opening flight booking...')} /> // Filter chip with selection <Chip variant="filter" label="Images" leadingIcon="filled.Star" selected={selectedFilters.includes('Images')} onPress={() => handleFilterToggle('Images')} /> // Input chip with dismiss <Chip variant="input" label="Work" leadingIcon="filled.Create" onDismiss={() => handleInputDismiss('Work')} /> // Suggestion chip <Chip variant="suggestion" label="Nearby" leadingIcon="filled.LocationOn" onPress={() => console.log('Searching nearby...')} />

See Official Jetpack Compose documentation for more information.

API

Component

Chip

Android

Type: React.Element<ChipProps>

Displays a native chip component.

ChipProps

enabled

Android
Optional • Type: boolean

Whether the chip is enabled and can be clicked. Used for assist, filter and input chips.

iconSize

Android
Optional • Type: number

Size of the icon in density-independent pixels (dp). Defaults to 18.

label

Android
Type: string

The text label to display on the chip

leadingIcon

Android
Optional • Type: string

Optional leading icon name (using Material Icons). Used for assist, filter, input (avatar icon), and suggestion chips.

modifiers

Android
Optional • Type: ExpoModifier[]

Modifiers for the component

onDismiss

Android
Optional • Type: () => void

Callback fired when the chip is dismissed. Only used for input chips.

onPress

Android
Optional • Type: () => void

Callback fired when the chip is clicked. Used for assist and filter chips.

selected

Android
Optional • Type: boolean

Whether the chip is selected. Used only for filter chips.

textStyle

Android
Optional • Type: ChipTextStyle

Text style variant for the chip label. Defaults to 'labelSmall'.

trailingIcon

Android
Optional • Type: string

Optional trailing icon name (using Material Icons). Used for assist, filter, and input chips. For input chips, defaults to 'filled.Close' if not specified.

variant

Android
Optional • Literal type: string

The variant of the chip

Acceptable values are: 'filter' | 'assist' | 'input' | 'suggestion'

Inherited Props

Types

ChipTextStyle

Android

Literal Type: string

Available text style variants for chip labels.

Acceptable values are: 'labelSmall' | 'labelMedium' | 'labelLarge' | 'bodySmall' | 'bodyMedium' | 'bodyLarge'