navigationcontrollerz-slideshowexperimental

Slideshow

Full-width deck carousel with slide/fade/scale/pull/push transitions, aspect-ratio sizing, drag/swipe, and autoplay.

Attributes

AttributeTypeDefaultDescription
animationSlideshowAnimation'slide'Deck transition: slide (default), fade, scale, pull, or push.
ratiostring'16:9'Aspect ratio of the items container, e.g. 16:9; false/none removes the ratio. Sets --z-slideshow-ratio and aspect-ratio on the list.
min-heightstring''Minimum height of the items container; bare numbers are treated as pixels.
max-heightstring''Maximum height of the items container; bare numbers are treated as pixels.
Inherited from CarouselBase
AttributeTypeDefaultDescription
activenumber—Index of the active slide; setting it navigates to that slide. -1 before initialization.
finitebooleanfalseStops at the first/last slide instead of looping; boundary controls are hidden and disabled.
autoplaybooleanfalseAdvances automatically every autoplay-interval ms; ticks pause while hovered, focused within, dragging, or the document is hidden.
autoplay-intervalnumber7000Autoplay interval in milliseconds (minimum 500, default 7000).
no-pause-on-hoverbooleanfalseKeeps autoplay running while the pointer is over the carousel.
no-dragbooleanfalseDisables pointer drag/swipe navigation.
durationnumber0Transition duration in ms. When unset, the component default (slider 350, slideshow 450) divided by velocity is used; an explicit 0 makes transitions instant.
velocitynumber1Speed multiplier applied to the default duration (default 1); ignored when duration is set.
easingstring''CSS easing for programmatic transitions; empty uses the component default.
Inherited from Base
AttributeTypeDefaultDescription
clsstring''Adds classes to named parts as key: classes pairs; a plain string targets the default part.
stlstring''Adds inline styles to named parts as key: styles pairs; a plain string targets the default part.

Custom Styling (cls / stl)

Default cls target:active · defaultstl target:host-inner

KeyDefault classclsstlDescription
activez-activeyesnoClass applied to the active slide and nav controls (default z-active).
draggingz-draggingyesnoClass applied to the items list while a pointer drag is in progress (default z-dragging).
next—yesnoMarker part for the next-arrow control (data-part="next").
previous—yesnoMarker part for the previous-arrow control (data-part="previous").

CSS Variables

VariableDefaultScopeDescription
--z-slideshow-ratio · hook16 / 9z-slideshow .z-slideshow-itemsAspect ratio applied to the items container, set from the ratio attribute.

Events

EventDetailFlagsDescription
z-slideshow:before-changeRecord<string, unknown>cancelable, bubblesCancelable; fires before the active slide changes. Detail carries index, previousIndex, slide, previousSlide, value, and dir.
z-slideshow:before-hideRecord<string, unknown>cancelable, bubblesCancelable; fires before the outgoing slide hides, with the same detail as before-change.
z-slideshow:before-showRecord<string, unknown>cancelable, bubblesCancelable; fires before the incoming slide shows, with the same detail as before-change.
z-slideshow:changeRecord<string, unknown>bubblesFires when the active slide changes, with the same detail as before-change.
z-slideshow:hiddenRecord<string, unknown>bubblesFires after the outgoing slide's transition completes.
z-slideshow:hideRecord<string, unknown>bubblesFires when the outgoing slide starts hiding.
z-slideshow:mount · from ControllerRecord<string, unknown>bubblesFires when deferred template content is mounted into the container.
z-slideshow:showRecord<string, unknown>bubblesFires when the incoming slide starts showing.
z-slideshow:shownRecord<string, unknown>bubblesFires after the incoming slide's transition completes.

Methods

SignatureDescription
count(): numberReturns the number of slides.
index(): numberReturns the current active index.
next(animate?: boolean = true): Promise<boolean>Advances to the next slide (wraps unless finite); resolves to whether the index changed.
previous(animate?: boolean = true): Promise<boolean>Moves to the previous slide (wraps unless finite); resolves to whether the index changed.
refresh(): voidFinalizes any running transition and re-initializes sizing, navigation, and autoplay.
show(target: number | 'next' | 'previous' | 'first' | 'last' | string, animate?: boolean = true): Promise<boolean>Navigates to an index, next/previous/first/last, or a slide's data-value/id; resolves to whether the index changed. Cancelable before-* events can veto it.
startAutoplay(): voidStarts the autoplay timer; a no-op unless autoplay is enabled.
stopAutoplay(): voidStops the autoplay timer.

Data Hooks

AttributeValuesApplies toRoleDescription
data-auto-nav-item · from CarouselBase—descendantconfigMarks nav items generated by the carousel; a fully auto nav is rebuilt to match the slide count.
data-autoplay · from CarouselBase—descendantconfigOn a slide video: plays it while the slide is active.
data-fn · from ControllertemplatedescendantconfigMarks a deferred <template> child whose content is mounted into the container on demand.
data-keep-playing · from CarouselBase—descendantconfigOn a slide video: keeps it playing when the slide becomes inactive.
data-part · from CarouselBasenext, previousdescendantmarkerMarks arrow controls: data-part="previous" and data-part="next".
data-value · from CarouselBase—descendantread-onlyOn a slide: its command value, usable as a show() target and carried in event detail.

CSS Classes

ClassRoleApplies toDescription
.z-activestate.z-slideshowState class on the visible slide.
.z-draggingstate.z-slideshowState class on the deck during a drag.
.z-slideshowrootz-slideshowRoot class, also styled on the z-slideshow host.
.z-slideshow-itemselement.z-slideshowThe deck container holding the slides; sized by ratio/min-height/max-height.

Keyboard

KeysActionWhen
ArrowLeft ArrowRightPrevious/next slide (direction flips in RTL).—
ArrowLeft ArrowRight ArrowUp ArrowDown Home EndMove within a nav tablist; Home/End jump to the first/last slide.Focus is inside a .z-slideshow-nav list.

Accessibility

  • The host is a role="region" with aria-roledescription="carousel"; slides are tabpanels (with nav) or groups labeled n of total.
  • Nav lists become role="tablist" with roving tabindex; the items list is aria-live="polite", switched to off while autoplay runs.