This is the first slide of the carousel.
Carousel
Displays multiple items in a sliding gallery.
---
import Heading from "@core-elements/heading/Heading.astro";
import Text from "@core-elements/text/Text.astro";
import Carousel from "@wrappers/carousel/Carousel.astro";
import CarouselSlide from "@wrappers/carousel/CarouselSlide.astro";
---
<Carousel label="" minSlideWidth={0} slideWidthPercent={100}>
<CarouselSlide>
<Heading alignX="center" level="h2">
Slide 1
</Heading>
<Text alignX="center">
<p>This is the first slide of the carousel.</p>
</Text>
</CarouselSlide>
<CarouselSlide>
<Heading alignX="center" level="h2">
Slide 2
</Heading>
<Text alignX="center">
<p>This is the second slide of the carousel.</p>
</Text>
</CarouselSlide>
<CarouselSlide>
<Heading alignX="center" level="h2">
Slide 3
</Heading>
<Text alignX="center">
<p>This is the third slide of the carousel.</p>
</Text>
</CarouselSlide>
</Carousel> ---
blocks:
_component: building-blocks/wrappers/carousel
slides:
- contentSections:
- _component: building-blocks/core-elements/heading
text: Slide 1
level: h2
alignX: center
- _component: building-blocks/core-elements/text
alignX: center
text: This is the first slide of the carousel.
- contentSections:
- _component: building-blocks/core-elements/heading
text: Slide 2
level: h2
alignX: center
- _component: building-blocks/core-elements/text
text: This is the second slide of the carousel.
alignX: center
- contentSections:
- _component: building-blocks/core-elements/heading
text: Slide 3
level: h2
alignX: center
- _component: building-blocks/core-elements/text
text: This is the third slide of the carousel.
alignX: center
label: ''
autoPlay: false
autoScroll: false
slideWidthPercent: 100
minSlideWidth: 0
--- 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.
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.
-
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.
-
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.
<CarouselSlide> 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
---