Skip to content

Carousel

<ax-carousel> is a horizontally scroll-snapping slide container. It’s built on native CSS scroll-snap, so touch/swipe works for free and there are no JS transforms (SSR-safe). It supports multiple slides per view, prev/next arrows, dot indicators, keyboard nav, and autoplay. Project <ax-carousel-slide> children.

import { AxCarouselComponent, AxCarouselSlideComponent } from '@axisui-ng/data';
<ax-carousel ariaLabel="Highlights">
<ax-carousel-slide>Slide one</ax-carousel-slide>
<ax-carousel-slide>Slide two</ax-carousel-slide>
<ax-carousel-slide>Slide three</ax-carousel-slide>
</ax-carousel>
<!-- two per view, looping, autoplay off -->
<ax-carousel [slidesPerView]="2" [loop]="true" [autoplay]="false" ariaLabel="Products">
<ax-carousel-slide></ax-carousel-slide>
<ax-carousel-slide></ax-carousel-slide>
</ax-carousel>
InputTypeDefaultNotes
slidesPerViewnumber1Visible slides per view (1–4 styled; others fall back to full width).
loopbooleanfalseWrap past the ends with the arrows.
autoplaybooleantrueAuto-advance (see Autoplay).
intervalnumber5000Autoplay interval (ms).
showArrowsbooleantruePrev/next arrows.
showIndicatorsbooleantrueDot indicators.
ariaLabelstring''Accessible label for the carousel region.
currentSlidemodel<number>0Two-way leading slide index.

Public methods: next(), previous(), goTo(index).

<ax-carousel-slide> has no public inputs — the parent assigns index; content is projected.

On by default. It starts only in the browser (afterNextRender), pauses on hover/focus, is skipped entirely under prefers-reduced-motion: reduce, and is cleared on destroy. A pause/play control appears when autoplay is active and there are more slides than slidesPerView. The viewport is aria-live="off" while autoplaying (and polite otherwise).

Host role="region" aria-roledescription="carousel" + aria-label from ariaLabel; each slide is role="group" aria-roledescription="slide" aria-label="{i} of {n}"; arrows (“Previous/Next slide”) and dots (Go to slide {i}) are labelled; ←/→ navigate. Prefer a non-empty ariaLabel.

Interactive examples live in Storybook under Data / Carousel. Run pnpm storybook to explore them.