Carousel
An image and content carousel with swipe gestures, autoplay, thumbnail navigation, and keyboard support.
Basic Usage
Image Carousel
A basic image carousel with dot navigation and arrow buttons.
import { Carousel } from 'fluxo-ui';
import type { CarouselSlide } from 'fluxo-ui';
const slides: CarouselSlide[] = [
{ id: 's1', type: 'image', src: '/photo1.jpg', alt: 'Mountain landscape' },
{ id: 's2', type: 'image', src: '/photo2.jpg', alt: 'Ocean sunset' },
{ id: 's3', type: 'image', src: '/photo3.jpg', alt: 'City skyline' },
];
<Carousel slides={slides} />Thumbnail Navigation
Use navigation="thumbnails" to display a clickable thumbnail strip below (or beside) the carousel.
Thumbnail Navigation
Navigate slides using clickable thumbnail strip below the main viewport.
import { Carousel } from 'fluxo-ui';
<Carousel
slides={slides}
navigation="thumbnails"
thumbnailPosition="bottom"
/>Autoplay
Enable autoplay with loop for continuous slide rotation. Autoplay pauses on hover.
Autoplay with Loop
Slides advance automatically every 3 seconds and loop back to the first slide. Pauses on hover.
import { Carousel } from 'fluxo-ui';
<Carousel
slides={slides}
autoplay
autoplayInterval={3000}
loop
/>Import
import { Carousel } from 'fluxo-ui';
import type { CarouselProps, CarouselSlide } from 'fluxo-ui';Carousel Props
slidesreqCarouselSlide[]Array of slide data.
slidesreqCarouselSlide[]Array of slide data.
activeIndexnumberControlled active slide index.
activeIndexnumberControlled active slide index.
onSlideChange(index: number) => voidCalled when the active slide changes.
onSlideChange(index: number) => voidCalled when the active slide changes.
navigation'dots' | 'arrows' | 'thumbnails' | 'none'"'dots'"Navigation style.
navigation'dots' | 'arrows' | 'thumbnails' | 'none'"'dots'"Navigation style.
thumbnailPosition'top' | 'bottom' | 'left' | 'right'"'bottom'"Position of thumbnail strip.
thumbnailPosition'top' | 'bottom' | 'left' | 'right'"'bottom'"Position of thumbnail strip.
autoplayboolean"false"Enable automatic slide advancement.
autoplayboolean"false"Enable automatic slide advancement.
autoplayIntervalnumber"5000"Autoplay interval in milliseconds.
autoplayIntervalnumber"5000"Autoplay interval in milliseconds.
loopboolean"false"Loop back to first slide after the last.
loopboolean"false"Loop back to first slide after the last.
showArrowsboolean"true"Show previous/next arrow buttons.
showArrowsboolean"true"Show previous/next arrow buttons.
showDotsbooleanShow dot indicators (overrides navigation).
showDotsbooleanShow dot indicators (overrides navigation).
lazyLoadboolean"false"Lazy-load images as they become active.
lazyLoadboolean"false"Lazy-load images as they become active.
swipeableboolean"true"Enable swipe/drag gesture navigation.
swipeableboolean"true"Enable swipe/drag gesture navigation.
aspectRatiostringCSS aspect ratio for slides (e.g. "16/9").
aspectRatiostringCSS aspect ratio for slides (e.g. "16/9").
classNamestringAdditional CSS class for the container.
classNamestringAdditional CSS class for the container.
slideClassNamestringAdditional CSS class for each slide.
slideClassNamestringAdditional CSS class for each slide.
CarouselSlide Interface
idreqstringUnique identifier for the slide.
idreqstringUnique identifier for the slide.
typereq'image' | 'video' | 'custom'Slide content type.
typereq'image' | 'video' | 'custom'Slide content type.
srcstringImage URL (for image type).
srcstringImage URL (for image type).
altstringAlt text for the image.
altstringAlt text for the image.
thumbnailstringThumbnail URL for thumbnail navigation.
thumbnailstringThumbnail URL for thumbnail navigation.
contentReactNodeCustom content (for custom type).
contentReactNodeCustom content (for custom type).
Features
Swipe Gestures
Touch and pointer swipe support for mobile and desktop navigation.
Autoplay
Auto-advance slides at a configurable interval, pausing on hover.
Thumbnails
Thumbnail strip with configurable position for visual slide selection.
Keyboard Navigation
Arrow keys navigate between slides with focus management.
Lazy Loading
Only load slide content when it becomes active to reduce initial bandwidth.
Accessibility
ARIA roledescription, tab roles for dots, and labeled arrow buttons.