Skip to Content
Referencefusion-uiComponentsDisplayCarousel

Carousel

The Carousel component is a powerful and flexible component for creating interactive, scrollable galleries of content. It supports draggable slides and optional navigation controls.


<Carousel padding={400} gap={400}>
  <Surface size={{ width: 800, height: 600 }} />
  <Surface size={{ width: 800, height: 600 }} />
  <Surface size={{ width: 800, height: 600 }} />
  <Surface size={{ width: 800, height: 600 }} />
  <Surface size={{ width: 800, height: 600 }} />
</Carousel>

Features

Controls

The Carousel provides different control options for navigation: arrows, indicators, or both. Use the controls prop with CarouselControls to specify the desired set of controls.


<Carousel
  padding={400}
  gap={400}
  controls={CarouselControls.Arrows}
>
  <Surface size={{ width: 800, height: 600 }} />
  <Surface size={{ width: 800, height: 600 }} />
  <Surface size={{ width: 800, height: 600 }} />
  <Surface size={{ width: 800, height: 600 }} />
  <Surface size={{ width: 800, height: 600 }} />
</Carousel>

<Carousel
  padding={400}
  gap={400}
  controls={CarouselControls.Indicators}
>
  <Surface size={{ width: 800, height: 600 }} />
  <Surface size={{ width: 800, height: 600 }} />
  <Surface size={{ width: 800, height: 600 }} />
  <Surface size={{ width: 800, height: 600 }} />
  <Surface size={{ width: 800, height: 600 }} />
</Carousel>

With Cards

The Carousel is versatile and can contain complex components like Cards.


<Carousel controls={CarouselControls.Indicators} padding={400}>
  <Card
    size={{ width: 850, height: "stretch" }}
    media={(
      <Image
        src="https://picsum.photos/seed/HP9SuN9Ce/1091/2522"
        aspectRatio="2:1"
      />
    )}
    info={{
      title: "Ruddy Turnstone",
      body: "Velum arceo desparatus. Corporis usitas carpo truculenter comburo curiositas nobis absconditus saepe. Constans admitto corporis bestia.",
    }}
  />
  <Card
    size={{ width: 850, height: "stretch" }}
    media={(
      <Image
        src="https://picsum.photos/seed/aOUNz/1802/1521"
        aspectRatio="2:1"
      />
    )}
    info={{
      title: "Little Curlew",
      body: "Capio attonbitus cernuus. Sursum ancilla vesica pel taedium. Peior tredecim pariatur stabilis conventus nesciunt congregatio succurro.",
    }}
  />
  <Card
    size={{ width: 850, height: "stretch" }}
    media={(
      <Image
        src="https://picsum.photos/seed/yTt8F/936/1335"
        aspectRatio="2:1"
      />
    )}
    info={{
      title: "Zenaida Dove",
      body: "Adulatio speculum adamo demum voluptate aggero. Cotidie ustulo demergo talus sequi civitas talis. Vorax solus velit.",
    }}
  />
</Carousel>

Anatomy

1.CarouselThe main container for the carousel.
2.SlidesThe draggable container for the slides.
3.SlideAn individual slide within the carousel.
4.ArrowsNavigation arrows to move between slides.
5.IndicatorsDots that indicate the current slide.

Reference

Props

NameTypeDefaultDescription
childrenArray<ReactNode>[]The array of slides to display in the carousel.
controlsCarouselControlsCarouselControls.BothThe type of navigation controls to display.
gapFlexSprinkles["gap"]-The gap between slides.
onChange(index: number) => void-Callback fired when the active slide changes.

The Carousel component also inherits all props from the Column component.

Tokens

KeyDefault Value
carousel.column.base.backgroundColornone
carousel.column.base.gapvar(--gpqiqdd)
carousel.slides.base.gapvar(--gpqiqd9)
carousel.slide.base.backgroundColornone
carousel.slide.base.borderRadiusnone
carousel.indicators.base.backgroundColorvar(--_1i4ikbk12)
carousel.indicators.base.borderRadiusvar(--gpqiqdw)
carousel.indicators.base.widthvar(--gpqiqca)
carousel.indicators.base.heightvar(--gpqiqca)
carousel.indicators.base.gapvar(--gpqiqd7)
carousel.indicators.variants.active.true.backgroundColorvar(--_1i4ikbkv)
Last updated on