Skip to content
Focsd homeFocsd homeFocsd
Forms

Carousel

A set of slides shown one at a time, with optional rotation.

  • Tag: focsd-carousel
  • Pattern: Carousel (pause, prev/next)
  • Category: Display

Example

Invoice template

Roadmap template

Retro template

HTML
<focsd-carousel label="Featured templates">
<focsd-carousel-slide><p>Invoice template</p></focsd-carousel-slide>
<focsd-carousel-slide><p>Roadmap template</p></focsd-carousel-slide>
<focsd-carousel-slide><p>Retro template</p></focsd-carousel-slide>
</focsd-carousel>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/components/focsd-carousel.js';
</script>
<focsd-carousel label="Featured templates">…</focsd-carousel>

API

Attributes

AttributePropertyTypeDefault
labellabelstring—
autoplayautoplaynumber0
indexindexnumber0

Methods

MethodDescription
go(index)Show slide index (wraps around).

Slots

SlotDescription
(default)Default content.

CSS parts

Style the inside of the component with ::part(), for example focsd-carousel::part(carousel).

PartDescription
carouselThe carousel element.
controlThe control element.
controlsThe row of carousel buttons.
nextThe next slide button.
previousThe previous slide button.
rotationThe play or pause button (with `autoplay`).
slidesThe container of the slides.

Accessibility

  • APG carousel: a labeled region with aria-roledescription="carousel"; slides are groups named "1 of 3". Hidden slides are inert.
  • With autoplay, a Stop/Start rotation button appears; rotation pauses while hovered or focused and starts paused under reduced motion.
  • Slide changes are announced politely except while rotating.