Skip to main content

Carousel

Image/content carousel with navigation.

Usage

<w-carousel label="Product images">
<w-slot prev><button>Previous</button></w-slot>
<w-slot next><button>Next</button></w-slot>

<w-slot item><div>Slide 1</div></w-slot>
<w-slot item><div>Slide 2</div></w-slot>
<w-slot item><div>Slide 3</div></w-slot>

<w-slot dots>
<div>
<w-slot dot><button></button></w-slot>
<w-slot dot><button></button></w-slot>
<w-slot dot><button></button></w-slot>
</div>
</w-slot>
</w-carousel>

Props

PropTypeDefaultDescription
valuenumber0Current slide index
loopbooleantrueLoop at ends
autoplaynumber0Auto-advance interval (ms), 0 to disable
labelstring""Accessible label

Slots

SlotElementDescription
itemAnyCarousel slides
prevButtonPrevious slide button
nextButtonNext slide button
indicatorsContainerIndicator container
indicatorButtonIndividual slide indicators

Events

EventDetailDescription
change{ value }Slide changed

Methods

MethodDescription
prev()Go to previous slide
next()Go to next slide
goTo(index)Go to specific slide

Keyboard

KeyAction
ArrowLeftPrevious slide
ArrowRightNext slide

Accessibility

  • Container has role="region" with aria-roledescription="carousel"
  • aria-label from label prop
  • Live region announces slide changes
  • Pause on hover/focus when autoplaying