Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub
← All Components

<mth-carousel>

@methane-ui/ui~11.2 KB brotli (cold + Lit)~3.8 KB marginal

Scroll-snap carousel supporting progressive CSS ::scroll-button enhancement, JS prev/next controls, RTL-aware roving focus indicators, and autoplay.

When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.

Live Interactive Preview

Multi-Framework Playground & Snippets

Properties & Attributes

PropertyAttributeTypeDefaultDescription
labellabelstring""Accessible region label for the carousel.
currentIndexcurrent-indexnumber0Zero-based index of the currently active slide.
slidesPerViewslides-per-viewnumber1Number of slides visible per viewport width.
looploopbooleanfalseWraps navigation from last slide back to first and vice versa.
autoplayautoplaybooleanfalseAutomatically advances slides on the configured interval.
intervalintervalnumber5000Autoplay interval duration in milliseconds.
showControlsshow-controlsbooleantrueDisplays previous and next navigation buttons.
showIndicatorsshow-indicatorsbooleantrueDisplays slide pagination indicator dots.

Events

EventDetail TypeDescription
mth-change{ index: number; total: number }Fired when the active slide index changes.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowLeft / ArrowRightbothslide indicator focusednavigates between slides (RTL-aware)
Home / Endbothslide indicator focusedjumps to first or last slide indicator
Enter / Spacebothprev/next/indicator focusedselects target slide and updates scroll track

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusdelegatesFocus: true with zero host internals.role (ADR-014).lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 3 APG keyboard transitions across LTR/RTL.mth-carousel.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(autoplay).Conformance suite
i18nRoutes 5 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test