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.
A chip component for displaying compact elements that represent inputs, attributes, or actions.
Installation
- npx expo install @expo/uiIf 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
Type: React.Element<ChipProps>
Displays a native chip component.
booleanWhether the chip is enabled and can be clicked. Used for assist, filter and input chips.
numberSize of the icon in density-independent pixels (dp). Defaults to 18.
stringOptional leading icon name (using Material Icons). Used for assist, filter, input (avatar icon), and suggestion chips.
() => voidCallback fired when the chip is dismissed. Only used for input chips.
() => voidCallback fired when the chip is clicked. Used for assist and filter chips.
ChipTextStyleText style variant for the chip label. Defaults to 'labelSmall'.
stringOptional trailing icon name (using Material Icons). Used for assist, filter, and input chips. For input chips, defaults to 'filled.Close' if not specified.
stringThe variant of the chip
Acceptable values are: 'filter' | 'assist' | 'input' | 'suggestion'