Skip to content

Interactive Carousel

Highlight the active item in an Embla React carousel with a sliding selection indicator. Preview it and copy the source.

Nature slide 1
Nature slide 2
Nature slide 3
Nature slide 4

Installation

npx uilayouts@latest add carousel

Usage

// !mark(16:20) gold
// !mark(22:24) blue
// !mark(26:28) green
// !mark(30) gold
// !mark(32) gold

import type { EmblaOptionsType } from 'embla-carousel';
import {
  Carousel,
  Slider,
  SliderContainer,
  SliderDotButton,
  SliderNextButton,
  SliderPrevButton,
} from './carousel';

function index() {
  const OPTIONS: EmblaOptionsType = { loop: false };
  return (
    <>
      <Carousel options={OPTIONS}>
        <SliderContainer>
          <Slider></Slider>
          <Slider></Slider>
          <Slider></Slider>
        </SliderContainer>

        <SliderPrevButton>
          <ChevronLeft />
        </SliderPrevButton>

        <SliderNextButton>
          <ChevronRight />
        </SliderNextButton>

        <SliderDotButton />

        <SliderSnapDisplay />
      </Carousel>
    </>
  );
}

Props

PropTypeDefaultDescription
defaultValuestringstring[]undefined
multiplebooleanfalseWhether the accordion allows multiple items to be active at the same time
childrenReactNode[]undefinedThe accordion items, including their headers and panels
classNamestring''Optional CSS class for styling the accordion wrapper

Example

Align Slider

Classname Slider

Number Slider

1
/ 0

Scale Slider

Thumbnail Slider

image
image
image
image
image
image
image

Autostart Slider

Autoscroll Slider

Slide 1

Slide 2

Slide 3

Slide 4

Vertical Slider

Slide 1
Slide 2
Slide 3
Slide 4

Vertical Thumbnail Slider

image
image
image
image
image
image
image

Vertical Autostart Thumbnail Slider

Slide 1
Slide 2
Slide 3
Slide 4
Slide 5