Hololink UI is under active development. Components, APIs and these docs may change without notice.
Holo Carousel & Carousel Item
<holo-carousel> manages a set of <holo-carousel-item> children and exposes a simple slide
selection API, keyboard navigation, and autoplay behavior. Each item is announced by its label
and can be controlled via the parent carousel’s selectedIndex property.
The carousel renders a role="region" named by the label prop (default “Featured content”). Each <holo-carousel-item> renders a role="group" named by its label, or “Slide N” when none is given. Slides that are not current get aria-hidden="true" and the inert attribute, so their content is not reachable by keyboard or screen reader. A role="status" live region (aria-live="polite") announces the current slide name when it changes.
Previous and next controls are native buttons named “Previous slide” and “Next slide”. With show-indicators and two or more slides, one native button per slide is added, named by the slide label (or “Slide N”), with aria-current on the active one.
Key
Action
Tab
Moves between the controls and indicators
Enter, Space
Activates the focused control
ArrowRight
Next slide
ArrowLeft
Previous slide
Home
First slide
End
Last slide
Arrow, Home and End keys work while focus is anywhere inside the carousel, because the key listener is on the host.
With loop off, the previous and next buttons are disabled at the ends.
Autoplay (off by default) pauses while the pointer is over the carousel or focus is inside it. There is no pause or stop button.
The slide transition only runs when prefers-reduced-motion: no-preference.
You provide:
A specific label for the carousel and for each slide, especially if a page has more than one carousel.
Accessible names for any links or buttons you place inside slides.
A way to pause if you enable autoplay, because moving content that starts automatically must be pausable under WCAG 2.2.2. Prefer leaving it off.
If true, the carousel wraps from last to first and first to last.
selectedIndex
selected-index
number
0
The zero-based index of the currently active slide. Updated as the user navigates.
showIndicators
show-indicators
boolean
true
If true, render slide indicator buttons.
Events
Event
Detail
Description
holoCarouselChange
{ index: number; item: HTMLElement; }
Emitted whenever the visible slide changes after the initial render. detail is
{ index: number; item: HTMLElement | null }, the new index and its holo-carousel-item.
Methods
Signature
Description
next() => Promise<void>
Moves to the next slide. Wraps to the first slide when loop is true; otherwise stays on the
last slide.
previous() => Promise<void>
Moves to the previous slide. Wraps to the last slide when loop is true; otherwise stays on
the first slide.
Slots
Slot
Description
(default)
The holo-carousel-item slides.
CSS custom properties
Property
Description
--holo-carousel-bg
Background color of the carousel frame.
--holo-carousel-border
Border color of the frame and the previous/next buttons.
--holo-carousel-button-bg
Background color of the previous/next buttons.
--holo-carousel-button-hover
Background color of the previous/next buttons on hover.