Skip to main content
VelinStyle v0.8.0
⌂ Home
  1. Docs
  2. Components
  3. Carousel

Carousel

The <velin-carousel> Web Component provides a touch-friendly slideshow with prev/next controls, dot indicators, optional autoplay with a pause control, keyboard navigation, and WCAG 2.2–aligned ARIA (0.7.0).

Basic Example

Slide 1
Slide 2
Slide 3
<velin-carousel>
  <div>Slide 1</div>
  <div>Slide 2</div>
  <div>Slide 3</div>
</velin-carousel>

Autoplay

Add the autoplay attribute. Set interval in milliseconds with interval (default 5000). A Pause / Play button appears in the indicator row (see pause control).

<velin-carousel autoplay interval="3000">
  <div>Slide 1</div>
  <div>Slide 2</div>
</velin-carousel>

Keyboard navigation

When focus is inside the carousel, arrow keys move between slides.

KeyAction
Arrow Left / Arrow RightPrevious / next slide
Home / EndFirst / last slide

Pause control

With autoplay, a pause button is added next to the dot indicators. It toggles aria-pressed, updates its label between “Pause automatic slide show” and “Resume automatic slide show”, and stops the timer until pressed again. Autoplay also pauses while the carousel is hovered or contains focus.

Accessibility

CSS Variables

VariableDescription
--velin-color-surface-brightControl button background
--velin-color-borderControl button border
--velin-color-primaryActive dot indicator
--velin-shadow-mdControl button shadow
--velin-color-focusFocus ring colour

JavaScript API

Attributes

AttributeTypeDescription
autoplayBooleanEnable auto-advancing slides
intervalNumberMilliseconds between slides (default 5000)

Methods

MethodDescription
prev()Go to previous slide
next()Go to next slide
goTo(index)Go to a specific slide by zero-based index

Events

EventDetailDescription
velin-slide-change{ index }Fired after every slide transition

Theme wählen