This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 54).
Chip
A Jetpack Compose Chip component for displaying compact elements.
Expo UI Chip matches the official Jetpack Compose Chip API and supports assist, filter, input, and suggestion chip variants.
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
Assist chip
import { Host, Chip } from '@expo/ui/jetpack-compose'; export default function AssistChipExample() { return ( <Host matchContents> <Chip variant="assist" label="Book Flight" onPress={() => console.log('Opening flight booking...')} /> </Host> ); }
Filter chip
import { useState } from 'react'; import { Host, Chip } from '@expo/ui/jetpack-compose'; export default function FilterChipExample() { const [selected, setSelected] = useState(false); return ( <Host matchContents> <Chip variant="filter" label="Images" selected={selected} onPress={() => setSelected(!selected)} /> </Host> ); }
Input chip
import { Host, Chip } from '@expo/ui/jetpack-compose'; export default function InputChipExample() { return ( <Host matchContents> <Chip variant="input" label="Work" onDismiss={() => console.log('Dismissed Work chip')} /> </Host> ); }
Suggestion chip
import { Host, Chip } from '@expo/ui/jetpack-compose'; export default function SuggestionChipExample() { return ( <Host matchContents> <Chip variant="suggestion" label="Nearby" onPress={() => console.log('Searching nearby...')} /> </Host> ); }
API
import { Chip } from '@expo/ui/jetpack-compose';
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.