💧 OMA Utilities WG • Water 2.0 has launched • Utility Membership •

🏙️ OMA Conformance Tool • Apply for Early Access •


Carousel

Usage

The ShCarousel constructor represents a carousel component that supports rotating slides, navigation control, and automatic slide transitions.

Basic

::ShCarousel
---
title: Carousel Example
subtitle: Basic Carousel
---
  :::ShMicroCard
  ---
  layout: flat
  icon: lineicons:nasa
  urlWrapper: https://www.nasa.gov/
  title: NASA
  subtitle: Beyond the Frontier 
  ---
  :::

  :::ShMicroCard
  ---
  layout: flat
  icon: gis:earth-euro-africa-o
  urlWrapper: https://science.nasa.gov/earth/facts/
  title: Earth 
  subtitle: The Blue Marble
  ---
  :::

  :::ShMicroCard
  ---
  layout: flat
  icon: streamline-emojis:new-moon
  urlWrapper: https://science.nasa.gov/moon/
  title: The Moon  
  subtitle: Earth's Companion
  ---
  :::

  :::ShMicroCard
  ---
  layout: flat
  icon: game-icons:mars-curiosity
  urlWrapper: https://science.nasa.gov/mars/
  title: Mars  
  subtitle: Meet the neighbour
  ---
  :::
::

You can combine components inside the :

This is not recommended because different components can have different styles and it can be difficult to manage the layout and appearance of the carousel. It is better to use a single type of component for consistency and ease of use.

Neil Armstrong

Neil A. Armstrong

Mission Commander

@NASA

Michael Collins

Michael Collins

Command Module Pilot

@NASA

Buzz Aldrin

Edwin E. Aldrin Jr.

Pilot of the Lunar Lander Eagle

@NASA

::ShCarousel
---
timer: 4
---
  :::ShMicroCard
  ---
  layout: flat
  icon: game-icons:lunar-module
  urlWrapper: https://www.nasa.gov/mission/apollo-11/
  title: Apollo 11
  subtitle: First Moon Landing- Crew
  ---
  :::

  :::ShAvatar
  ---
  srcAvatar: https://endz.in/wp-content/uploads/2020/05/neil-armstrong-9188943-2-402-1024x1024.jpg
  altAvatar: Neil Armstrong
  name: Neil A. Armstrong
  role: Mission Commander
  company: NASA
  ---
  :::

  :::ShAvatar
  ---
  srcAvatar: https://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/Michael_Collins_%28S69-31742%2C_restoration%29.jpg/500px-Michael_Collins_%28S69-31742%2C_restoration%29.jpg
  altAvatar: Michael Collins
  name: Michael Collins
  role: Command Module Pilot
  company: NASA
  ---
  :::

  :::ShAvatar
  ---
  srcAvatar: https://upload.wikimedia.org/wikipedia/commons/9/98/Aldrin_Apollo_11_original.jpg
  altAvatar: Buzz Aldrin
  name: Edwin E. Aldrin Jr.
  role: Pilot of the Lunar Lander Eagle
  company: NASA
  ---
  :::
::

Advanced settings

Advanced Carousel Example

Manual Control Over Slides Loop

Neil Armstrong

Neil A. Armstrong

Mission Commander

@NASA

Michael Collins

Michael Collins

Command Module Pilot

@NASA

Buzz Aldrin

Edwin E. Aldrin Jr.

Pilot of the Lunar Lander Eagle

@NASA

::ShCarousel
---
ui:
  wrapper: dark:bg-neutral-800
title: Advanced Carousel Example
subtitle: Manual Control Over Slides Loop
timer: 0 #Disable auto-slide
slides: 2 #Show 2 slides at once
---
  :::ShMicroCard
  ---
  layout: flat
  icon: game-icons:lunar-module
  urlWrapper: https://www.nasa.gov/mission/apollo-11/
  title: Apollo 11
  subtitle: First Moon Landing- Crew
  ---
  :::

  :::ShAvatar
  ---
  srcAvatar: https://endz.in/wp-content/uploads/2020/05/neil-armstrong-9188943-2-402-1024x1024.jpg
  altAvatar: Neil Armstrong
  name: Neil A. Armstrong
  role: Mission Commander
  company: NASA
  ---
  :::

  :::ShAvatar
  ---
  srcAvatar: https://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/Michael_Collins_%28S69-31742%2C_restoration%29.jpg/500px-Michael_Collins_%28S69-31742%2C_restoration%29.jpg
  altAvatar: Michael Collins
  name: Michael Collins
  role: Command Module Pilot
  company: NASA
  ---
  :::

  :::ShAvatar
  ---
  srcAvatar: https://upload.wikimedia.org/wikipedia/commons/9/98/Aldrin_Apollo_11_original.jpg
  altAvatar: Buzz Aldrin
  name: Edwin E. Aldrin Jr.
  role: Pilot of the Lunar Lander Eagle
  company: NASA
  ---
  :::
::

Props

PropTypeDefaultDescription
slidesnumber1Number of slides to show at once; determines how many components are displayed in one view.
timernumber2Interval in seconds for automatic slide transitions. Set to `0` to disable auto-transition.
titlestring''Optional title text displayed above the carousel. Styled via `ui.title`.
subtitlestring''Optional subtitle text shown below the title. Styled via `ui.subtitle`.
navigationVisiblebooleantrueControls whether the navigation dots (pagination dots) are displayed below/inside the carousel.
direction'horizontal' | 'vertical''horizontal'Axis the slides travel along. Use `horizontal` to slide sideways, or `vertical` to slide upwards.
descriptionstring''Note for content writers. It is not rendered on the website.
uiRecord<string, any>–Overrides the default classes of the UI config below. Values are merged with the defaults using tailwind-merge.

Slots

This component has no slots.

UI config

Default classes of every styled element. Override any key through the ui prop.

KeyDefault classesDescription
wrapperrelative w-fullOutermost container of the carousel.
titletitle text-center text-xl md:text-[24px] font-semibold break-wordsStyles applied to the title text (e.g. font size, color).
subtitlesubtitle text-center text-lg md:text-[20px] font-semibold text-neutral-600 dark:text-neutral-300 -mt-5 break-wordsStyles applied to the subtitle text (e.g. font size, color).
inneroverflow-hiddenDefines the styling for the inner sliding container.
trackgrid grid-cols-1Styles for the grid that stacks every slide in the same cell, so the carousel is as tall as its tallest slide.
groupcol-start-1 row-start-1 flex justify-center gap-4Styles applied to each slide group (the set of components shown together in one view).