Skip to main content

Carousel

Rocket 2.0

The Carousel component shows a set of images one or several at a time, with arrows, dots, swipes and optional autoplay. Use it for featured items, product photos or announcements on a dashboard.

Properties​

Property
Description
Expected Value
SlidesThe slides to show. Each item is an object with image, title, description and link, or just an image URL. Clicking a slide with a link opens it in a new tab.Array
Start at slide (0-based)The slide the carousel starts on, counting from 0. Changing it moves to that slide without firing On slide changed.Number. Default: 0
Current slide (0-based)The slide shown now, counting from 0. It updates as the user moves through the slides.Number. Default: 0
Aspect ratioShape of each slide. fill stretches the slides to fill the component's box.fill, 16/9, 4/3, 3/2, 1/1, 21/9, 3/4. Default: fill
Image fitCover fills the slide and crops the image; Contain shows the whole image inside the slide.Cover, Contain. Default: Cover
CaptionWhere a slide's title and description appear: Overlay on top of the image, Below it, or None to hide them.Overlay, Below, None. Default: Overlay
Slides per view (1 to 4)How many slides are visible side by side, from 1 to 4.Number. Default: 1
Show arrowsShows previous and next arrows over the slides.On or off. Default: On
Show dotsShows a row of dots under the slides that the user can click to jump to a slide.On or off. Default: On
LoopMoves from the last slide back to the first, and from the first to the last, instead of stopping at the ends.On or off. Default: On
AutoplayMoves to the next slide on its own every Autoplay interval (ms).On or off. Default: Off
Autoplay interval (ms)Time between automatic slide changes, in milliseconds. The shortest allowed is 1000.Number. Default: 5000
Pause on hoverPauses autoplay while the pointer is over the carousel.On or off. Default: On
Loading lookWhat the carousel shows while it is loading: a Spinner or a Skeleton placeholder.Spinner, Skeleton. Default: Spinner

Additional Actions​

Each of these can be switched on or off, or set with a logical expression by clicking fx.

Property
Description
Expected Value
VisibilityShows or hides the component. Hidden components keep their space unless Collapse when hidden is on.On or off. Default: On
Collapse when hiddenRemoves the hidden component's space, so the components below it move up.On or off. Default: Off
Loading stateShows the component's loading look and blocks interaction, for example while a query runs.On or off. Default: Off
DisableStops the user from interacting with the component.On or off. Default: Off

Devices​

Property
Description
Expected Value
Show on desktopShows the component in the desktop layout.On or off. Default: On
Show on mobileShows the component in the mobile layout.On or off. Default: Off

Events​

Add a handler from the Events section of the properties panel. See Event Triggers for the steps.

Event
Description
On slide changedTriggers when the carousel moves to a different slide, whether by the user, autoplay or an action.
On slide clickedTriggers when the user clicks a slide.

Component Specific Actions (CSA)​

Run these from an event handler with Control Component, or from a RunJS query. See Component Specific Actions.

Action
Description
How To Access
Next slideMoves to the next slide.components.carousel1.next()
Previous slideMoves to the previous slide.components.carousel1.previous()
Go to slideMoves to the slide at Index (0-based).components.carousel1.goTo("")
Set visibilityShows the component when true, hides it when false.components.carousel1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.carousel1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.carousel1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
slidesThe slides to show. Each item is an object with image, title, description and link, or just an image URL. Clicking a slide with a link opens it in a new tab.{{components.carousel1.slides}}
defaultIndexThe slide the carousel starts on, counting from 0. Changing it moves to that slide without firing On slide changed.{{components.carousel1.defaultIndex}}
currentIndexThe slide shown now, counting from 0. It updates as the user moves through the slides.{{components.carousel1.currentIndex}}
aspectRatioShape of each slide. fill stretches the slides to fill the component's box.{{components.carousel1.aspectRatio}}
imageFitCover fills the slide and crops the image; Contain shows the whole image inside the slide.{{components.carousel1.imageFit}}
captionPositionWhere a slide's title and description appear: Overlay on top of the image, Below it, or None to hide them.{{components.carousel1.captionPosition}}
slidesPerViewHow many slides are visible side by side, from 1 to 4.{{components.carousel1.slidesPerView}}
showArrowsShows previous and next arrows over the slides.{{components.carousel1.showArrows}}
showDotsShows a row of dots under the slides that the user can click to jump to a slide.{{components.carousel1.showDots}}
loopMoves from the last slide back to the first, and from the first to the last, instead of stopping at the ends.{{components.carousel1.loop}}
autoplayMoves to the next slide on its own every Autoplay interval (ms).{{components.carousel1.autoplay}}
intervalTime between automatic slide changes, in milliseconds. The shortest allowed is 1000.{{components.carousel1.interval}}
pauseOnHoverPauses autoplay while the pointer is over the carousel.{{components.carousel1.pauseOnHover}}
loadingIndicatorWhat the carousel shows while it is loading: a Spinner or a Skeleton placeholder.{{components.carousel1.loadingIndicator}}
currentSlideThe slide shown now, as its image, title, description and link.{{components.carousel1.currentSlide}}
clickedSlideThe slide the user last clicked, with its index.{{components.carousel1.clickedSlide}}
isVisibleWhether the component is visible.{{components.carousel1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.carousel1.isLoading}}
isDisabledWhether the component is disabled.{{components.carousel1.isDisabled}}

Styles​

Style
Default
Slide backgroundTheme: Surface 3
Arrow backgroundTheme: Surface 1
Arrow icon colorTheme: Primary text
Dot colorTheme: Primary text
Active dot colorTheme: Brand primary
Caption overlay background—
Caption overlay text color#fff
Caption title color (below)Theme: Primary text
Caption description color (below)Theme: Placeholder text
Slide radius—
Gap between slides (px)—
Box shadow0px 0px 0px 0px #00000040

A default that starts with Theme: follows the app's theme until the style is set to another value. See App Themes.