SwipeUI

Carousel

Native paging with overlay navigation, thumbnails and opt-in automatic playback.

npx @swipeui/cli add carousel
Variant
Preset
Material
Scheme
Feel
Real free component with a browser animation bridge. Native motion, haptics and materials need a device.

When to use it

  • Onboarding slides, feature tours or photo galleries that people swipe through.
  • Horizontal paging of cards with page dots below.
  • A small set of promotions where each page fills the width.

When not to use it

  • Important content people might miss on later pages.
  • Automatic rotation without an accessible pause/resume control.
  • Long product lists. Use a horizontal list or grid.

Installation

Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.

npx @swipeui/cli add carousel
  • Adds components/swipeui/ui/use-carousel-autoplay.ts, components/swipeui/ui/carousel.tsx and 8 shared helpers.
  • Installs react-native-reanimated, react-native-worklets, uniwind, clsx, tailwind-merge, expo-haptics, class-variance-authority. In Expo apps it uses npx expo install so versions match your SDK.

Usage

app/onboarding.tsx
import { Carousel } from '@/components/swipeui/ui/carousel';

<Carousel pages={pages} />;

API reference

PropTypeDefaultDescription
pageAspectRatio?number—

Constrain the page viewport to width / height; omit for intrinsic content.

navigationPlacement?"below" | "inside"'inside'

Position navigation over the page or below it.

autoPlay?booleanfalse

Opt-in automatic page changes.

autoPlayInterval?number4000

Time each page is held, in milliseconds, at least 1000.

loop?booleanfalse

Wrap from the last page to the first.

paused?boolean—

Controlled user pause state. Focus/hover/preferences may suspend independently.

defaultPaused?booleanfalse

Initial user pause state.

onPausedChange?((paused: boolean) => void)—

Reports explicit playback changes.

showPlaybackControl?booleantrue

Show a named playback toggle when autoPlay is enabled.

showThumbnails?booleanfalse

Show the caller-supplied thumbnail strip.

thumbnailSize?number56

Thumbnail frame in points, at least 44.

showIndicators?booleantrue

Show page markers or a translated count.

showNavigation?booleantrue

Show previous/next controls.

maxIndicators?number7

Maximum dots before switching to a count, 1–50.

haptics?booleantrue

Navigation feedback.

messages?object—

Text overrides; empty overrides legacy emptyLabel.

pagesreadonly CarouselPage[]—

Pages in reading order.

emptyLabel?string'No pages'

Empty collection label.

index?number—

Controlled page index.

defaultIndex?number0

Initial page index.

onIndexChange?((index: number) => void)—

Reports navigation intent, including automatic progression.

motion?MotionOverride—

Indicator/press character; reduced motion disables automatic rotation.

className?string—

Root classes.

style?StyleProp<ViewStyle>—

Root layout escape hatch.

testID?string—

Root identifier.

Composition and behavior

  • pages in reading order, each with an id and content.
  • Page dots below for navigation; emptyLabel for no pages.
  • Control with index and onIndexChange, or defaultIndex.
  • Supply thumbnail on each page and enable showThumbnails for a preview strip.
  • autoPlay is opt-in, with autoPlayInterval, loop and independent pause state. Focus/manual interaction stops rotation until explicit resume; reduced motion and native screen readers suspend it.

Behavior and gestures

  • Manual paging by swipe, named arrows, page markers or optional thumbnails.
  • Optional automatic rotation with interval, loop and explicit pause/resume; interaction/focus stops rotation until resumed, hover suspends it.
  • Resizing retains the selected page. Offscreen/background, native screen reader and reduced motion suspend automatic rotation.

Accessibility

  • Named 44pt previous/next and page controls provide alternatives to swiping.
  • messages.page translates every page label; large collections use a count.
  • Page content retains its own interactive descendants.

Motion

  • Uses the select motion role, so it follows your app's feel. Pass motion to tune this one instance.
  • Paging is native scrolling; dots use the select role.
  • Reduce Motion jumps between pages when you tap a dot.
  • Reduced motion disables automatic rotation; focus and manual interaction stop it until explicit resume.

Performance

  • Pages are virtualised with FlatList, so long galleries stay light.

Notes for AI

  • Give pages unique ids; pass index with onIndexChange to control it.

Compatibility

Runs onSupported
Expo SDK 57Yes
Expo SDK 58Yes
React Native CLI (with Expo modules)Yes
Expo GoYes
iOSYes
AndroidYes

This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.

Related items