Skip to content
Anjunar/ DOCS

Carousel

Looping slides with explicit state and stable SSR.
Sequenced content
One active slide, one lifecycle
Navigation, indicators, keyboard input and autoplay all update the same reactive selection.
Looping
Next after the last slide starts at the beginning.
Autoplay
A positive interval advances only while the control is mounted.
SSR states
The server can expose every slide or only the active one.
Autoplay carousel
Previous, Next and every indicator remain explicit actions while the timer is active.
Active slide: 1 / 4 | autoAdvanceMs = 2600
Carousel DSL
The contextual renderer owns only the content of one slide.
scala
carousel[SlideCard] { items = slides autoAdvanceMs = 2600 ssrShowAllStates = true slideRenderer = (slide: SlideCard, index: Int) => renderSlide(slide, index) }
Loop
No dead right edge
next(), previous() and indicators share the same normalized active index.
Timer
Autoplay remains disposable
Changing the interval replaces the timer; unmounting always clears it.
Hydration
Both modes keep one tree shape
Active-only mode uses a dynamic mount point on the server and in the browser.