This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
Reference Expo UI Jetpack Compose Carousel Jetpack Compose Carousel components for displaying scrollable collections of items.
Recommended version:
~58.1.0
Expo UI provides three carousel components matching the official Jetpack Compose Carousel API: HorizontalCenteredHeroCarousel, HorizontalMultiBrowseCarousel, and HorizontalUncontainedCarousel.
Note: Carousel is a horizontally scrollable component, so the parent Host must provide a finite width on the scroll axis. Use matchContents={{ vertical: true }} together with style={{ width: '100%' }} (or any finite width). See Match contents in Host reference for details.
Installation
- npx expo install @expo/ui
- yarn expo install @expo/ui
- pnpm expo install @expo/ui
- bun expo install @expo/ui
If you are installing this in an existing React Native app , make sure to install expo in your project.
Usage
HorizontalCenteredHeroCarousel
Centers one large hero item between two small peek items — ideal for spotlighting content like movie posters.
import {
Host ,
HorizontalCenteredHeroCarousel ,
Box ,
Text ,
} from '@expo/ui/jetpack-compose' ;
import {
size,
background,
maskClip,
Shapes ,
} from '@expo/ui/jetpack-compose/modifiers' ;
export default function CenteredHeroExample ( ) {
const colors = [
'#6200EE' ,
'#03DAC5' ,
'#FF5722' ,
'#4CAF50' ,
'#2196F3' ,
] ;
return (
< Host
matchContents = { { vertical: true } }
style = { { width: '100%' } } >
< HorizontalCenteredHeroCarousel itemSpacing = { 8 } >
{ colors. map ( ( color, index) => (
< Box
key = { index}
contentAlignment = " center"
modifiers = { [
size ( 300 , 200 ) ,
maskClip ( Shapes . RoundedCorner ( 28 ) ) ,
background ( color) ,
] } >
< Text color = " #FFFFFF" > Slide { index + 1 } </ Text >
</ Box >
) ) }
</ HorizontalCenteredHeroCarousel >
</ Host >
) ;
}
HorizontalMultiBrowseCarousel
Shows a large item alongside smaller peek items, letting users browse what comes next.
import {
Host ,
HorizontalMultiBrowseCarousel ,
Box ,
Text ,
} from '@expo/ui/jetpack-compose' ;
import {
size,
background,
} from '@expo/ui/jetpack-compose/modifiers' ;
export default function MultiBrowseExample ( ) {
const colors = [
'#6200EE' ,
'#03DAC5' ,
'#FF5722' ,
'#4CAF50' ,
'#2196F3' ,
] ;
return (
< Host
matchContents = { { vertical: true } }
style = { { width: '100%' } } >
< HorizontalMultiBrowseCarousel
preferredItemWidth = { 200 }
itemSpacing = { 8 }
flingBehavior = " singleAdvance" >
{ colors. map ( ( color, index) => (
< Box
key = { index}
contentAlignment = " center"
modifiers = { [ size ( 200 , 180 ) , background ( color) ] } >
< Text color = " #FFFFFF" > Card { index + 1 } </ Text >
</ Box >
) ) }
</ HorizontalMultiBrowseCarousel >
</ Host >
) ;
}
HorizontalUncontainedCarousel
Each item has a fixed width with free-form scrolling.
import {
Host ,
HorizontalUncontainedCarousel ,
Box ,
Text ,
} from '@expo/ui/jetpack-compose' ;
import {
size,
background,
} from '@expo/ui/jetpack-compose/modifiers' ;
export default function UncontainedExample ( ) {
const items = [
'Photo 1' ,
'Photo 2' ,
'Photo 3' ,
'Photo 4' ,
'Photo 5' ,
] ;
return (
< Host
matchContents = { { vertical: true } }
style = { { width: '100%' } } >
< HorizontalUncontainedCarousel
itemWidth = { 160 }
itemSpacing = { 12 }
contentPadding = { { start: 16 , top: 0 , end: 16 , bottom: 0 } } >
{ items. map ( item => (
< Box
key = { item}
contentAlignment = " center"
modifiers = { [ size ( 160 , 180 ) , background ( '#3F51B5' ) ] } >
< Text color = " #FFFFFF" > { item} </ Text >
</ Box >
) ) }
</ HorizontalUncontainedCarousel >
</ Host >
) ;
}
API
import {
HorizontalCenteredHeroCarousel ,
HorizontalMultiBrowseCarousel ,
HorizontalUncontainedCarousel ,
} from '@expo/ui/jetpack-compose' ;
Components HorizontalCenteredHeroCarouselType: React.Element < ComponentType< HorizontalCenteredHeroCarouselProps > >
A hero carousel that centers one large item between two small peek items,
matching Compose's HorizontalCenteredHeroCarousel.
Shared props across all carousel components.
HorizontalCenteredHeroCarouselProps
Deprecated: Use preferredItemWidth instead. The value is now a preferred width, not a maximum.
Optional • Type: number
Optional • Type: number • Default: CarouselDefaults.MaxSmallItemSize
Maximum width of small peek items in dp.
Optional • Type: number • Default: CarouselDefaults.MinSmallItemSize
Minimum width of small peek items in dp.
Optional • Type: number
The width that the large item aims for in dp. The carousel picks the arrangement whose large
item width is closest to this value, so the final width can differ.
When unspecified, one large item fills the viewport beside two small items.
HorizontalMultiBrowseCarouselType: React.Element < ComponentType< HorizontalMultiBrowseCarouselProps > >
A carousel that shows a large item alongside smaller peek items,
matching Compose's HorizontalMultiBrowseCarousel.
Shared props across all carousel components.
HorizontalMultiBrowseCarouselProps
Optional • Type: number • Default: CarouselDefaults.MaxSmallItemSize
Maximum width of small peek items in dp.
Optional • Type: number • Default: CarouselDefaults.MinSmallItemSize
Minimum width of small peek items in dp.
Type: number
The preferred width of the large item in dp.
HorizontalUncontainedCarouselType: React.Element < ComponentType< HorizontalUncontainedCarouselProps > >
A carousel where each item has a fixed width with free-form scrolling,
matching Compose's HorizontalUncontainedCarousel.
Shared props across all carousel components.
HorizontalUncontainedCarouselProps
Type: number
The width of each item in dp.
Types Shared props across all carousel components.
Literal type: string
Fling behavior type for controlling carousel snapping.
Acceptable values are: 'singleAdvance' | 'noSnap'
Per-side padding values in dp for the content.