Carousel

Displays multiple items in a sliding gallery.

Overview

A carousel for displaying multiple slides of content. Supports autoplay and auto-scroll options, with configurable slide widths and minimum sizes to maintain responsive layouts.

Properties

label string

Optional label for the carousel to help identify it in the editor.

slides array | default: array

Array of slides to display in the carousel.

Item Properties:

contentSections array | default: array

autoPlay boolean | default: false

Enable auto-play functionality.

autoScroll boolean | default: false

Enable auto-scroll functionality.

loop boolean | default: true

Loop the carousel back to the beginning when reaching the end.

showIndicators boolean | default: true

Show dot indicators below the carousel.

showArrows boolean | default: true

Show previous and next arrow buttons.

align enum | default: center

Alignment of slides within the carousel viewport.

Accepted values:
  • start
  • center
  • end

slidesToScroll enum | default: auto

Number of slides to scroll at a time, or "auto" to scroll by the number of visible slides.

Accepted values:
  • auto
  • 1
  • 2
  • 3
  • 4

slideWidthPercent string | default: 100

Width of each slide as a percentage of the carousel (e.g., 33, 50, 100).

minSlideWidth number | default: 0

Minimum width of slides in pixels. Prevents slides from getting too small.

Slots

default

The contents for the the Carousel. Used only when the slides property is not set.

Child Component:
<CarouselSlide>
Properties (documented under the slides property above):
  • contentSections/slot

Examples

Auto play

---
import Image from "@core-elements/image/Image.astro";
import Carousel from "@wrappers/carousel/Carousel.astro";
import CarouselSlide from "@wrappers/carousel/CarouselSlide.astro";
---

<Carousel autoPlay>
  <CarouselSlide>
    <Image alt="Quiet Street" source="/src/assets/images/component-docs/quiet-street.jpg" />
  </CarouselSlide>
  <CarouselSlide>
    <Image alt="Sunset" source="/src/assets/images/component-docs/sunset.jpg" />
  </CarouselSlide>
  <CarouselSlide>
    <Image alt="Sheep" source="/src/assets/images/component-docs/sheep.jpg" />
  </CarouselSlide>
  <CarouselSlide>
    <Image alt="Castle" source="/src/assets/images/component-docs/castle.jpg" />
  </CarouselSlide>
  <CarouselSlide>
    <Image alt="Dunedin Cliff" source="/src/assets/images/component-docs/dunedin-cliff.jpg" />
  </CarouselSlide>
</Carousel>
---
blocks:
  _component: building-blocks/wrappers/carousel
  autoPlay: true
  slides:
    - contentSections:
        - _component: building-blocks/core-elements/image
          source: /src/assets/images/component-docs/quiet-street.jpg
          alt: Quiet Street
    - contentSections:
        - _component: building-blocks/core-elements/image
          source: /src/assets/images/component-docs/sunset.jpg
          alt: Sunset
    - contentSections:
        - _component: building-blocks/core-elements/image
          source: /src/assets/images/component-docs/sheep.jpg
          alt: Sheep
    - contentSections:
        - _component: building-blocks/core-elements/image
          source: /src/assets/images/component-docs/castle.jpg
          alt: Castle
    - contentSections:
        - _component: building-blocks/core-elements/image
          source: /src/assets/images/component-docs/dunedin-cliff.jpg
          alt: Dunedin Cliff
---

Auto scroll

---
import Image from "@core-elements/image/Image.astro";
import Carousel from "@wrappers/carousel/Carousel.astro";
import CarouselSlide from "@wrappers/carousel/CarouselSlide.astro";
---

<Carousel autoScroll>
  <CarouselSlide>
    <Image alt="Quiet Street" source="/src/assets/images/component-docs/quiet-street.jpg" />
  </CarouselSlide>
  <CarouselSlide>
    <Image alt="Sunset" source="/src/assets/images/component-docs/sunset.jpg" />
  </CarouselSlide>
  <CarouselSlide>
    <Image alt="Sheep" source="/src/assets/images/component-docs/sheep.jpg" />
  </CarouselSlide>
  <CarouselSlide>
    <Image alt="Castle" source="/src/assets/images/component-docs/castle.jpg" />
  </CarouselSlide>
  <CarouselSlide>
    <Image alt="Dunedin Cliff" source="/src/assets/images/component-docs/dunedin-cliff.jpg" />
  </CarouselSlide>
</Carousel>
---
blocks:
  _component: building-blocks/wrappers/carousel
  autoScroll: true
  slides:
    - contentSections:
        - _component: building-blocks/core-elements/image
          source: /src/assets/images/component-docs/quiet-street.jpg
          alt: Quiet Street
    - contentSections:
        - _component: building-blocks/core-elements/image
          source: /src/assets/images/component-docs/sunset.jpg
          alt: Sunset
    - contentSections:
        - _component: building-blocks/core-elements/image
          source: /src/assets/images/component-docs/sheep.jpg
          alt: Sheep
    - contentSections:
        - _component: building-blocks/core-elements/image
          source: /src/assets/images/component-docs/castle.jpg
          alt: Castle
    - contentSections:
        - _component: building-blocks/core-elements/image
          source: /src/assets/images/component-docs/dunedin-cliff.jpg
          alt: Dunedin Cliff
---

Width percentage

---
import Image from "@core-elements/image/Image.astro";
import Card from "@wrappers/card/Card.astro";
import Carousel from "@wrappers/carousel/Carousel.astro";
import CarouselSlide from "@wrappers/carousel/CarouselSlide.astro";
---

<Carousel minSlideWidth={200} slideWidthPercent={33}>
  <CarouselSlide>
    <Card paddingHorizontal="xs" paddingVertical="none">
      <Image alt="Quiet Street" source="/src/assets/images/component-docs/quiet-street.jpg" />
    </Card>
  </CarouselSlide>
  <CarouselSlide>
    <Card paddingHorizontal="xs" paddingVertical="none">
      <Image alt="Sunset" source="/src/assets/images/component-docs/sunset.jpg" />
    </Card>
  </CarouselSlide>
  <CarouselSlide>
    <Card paddingHorizontal="xs" paddingVertical="none">
      <Image alt="Sheep" source="/src/assets/images/component-docs/sheep.jpg" />
    </Card>
  </CarouselSlide>
  <CarouselSlide>
    <Card paddingHorizontal="xs" paddingVertical="none">
      <Image alt="Castle" source="/src/assets/images/component-docs/castle.jpg" />
    </Card>
  </CarouselSlide>
  <CarouselSlide>
    <Card paddingHorizontal="xs" paddingVertical="none">
      <Image alt="Dunedin Cliff" source="/src/assets/images/component-docs/dunedin-cliff.jpg" />
    </Card>
  </CarouselSlide>
</Carousel>
---
blocks:
  _component: building-blocks/wrappers/carousel
  slideWidthPercent: 33
  minSlideWidth: 200
  slides:
    - contentSections:
        - _component: building-blocks/wrappers/card
          paddingHorizontal: xs
          paddingVertical: none
          contentSections:
            - _component: building-blocks/core-elements/image
              source: /src/assets/images/component-docs/quiet-street.jpg
              alt: Quiet Street
    - contentSections:
        - _component: building-blocks/wrappers/card
          paddingHorizontal: xs
          paddingVertical: none
          contentSections:
            - _component: building-blocks/core-elements/image
              source: /src/assets/images/component-docs/sunset.jpg
              alt: Sunset
    - contentSections:
        - _component: building-blocks/wrappers/card
          paddingHorizontal: xs
          paddingVertical: none
          contentSections:
            - _component: building-blocks/core-elements/image
              source: /src/assets/images/component-docs/sheep.jpg
              alt: Sheep
    - contentSections:
        - _component: building-blocks/wrappers/card
          paddingHorizontal: xs
          paddingVertical: none
          contentSections:
            - _component: building-blocks/core-elements/image
              source: /src/assets/images/component-docs/castle.jpg
              alt: Castle
    - contentSections:
        - _component: building-blocks/wrappers/card
          paddingHorizontal: xs
          paddingVertical: none
          contentSections:
            - _component: building-blocks/core-elements/image
              source: /src/assets/images/component-docs/dunedin-cliff.jpg
              alt: Dunedin Cliff
---