Carousel

A carousel with motion and swipe built using Embla.

1

2

3

4

5

About

Carousel is built on top of Embla Carousel library and the embla-carousel-angular wrapper .

Installation

npx nx g @spartan-ng/cli:ui carousel

Usage

import {
	HlmCarousel
	HlmCarouselContent
	HlmCarouselItem
	HlmCarouselNext
	HlmCarouselPrevious
} from '@spartan-ng/helm/carousel';
<hlm-carousel>
  <hlm-carousel-content>
    <hlm-carousel-item>
      Item Content
    </hlm-carousel-item>
  </hlm-carousel-content>
  <button hlm-carousel-previous></button>
  <button hlm-carousel-next></button>
</hlm-carousel>

Helm API

HlmCarouselContent

Selector: hlm-carousel-content

Inputs

PropTypeDefaultDescription
class ClassValue --

HlmCarouselItem

Selector: hlm-carousel-item

Inputs

PropTypeDefaultDescription
class ClassValue --

HlmCarouselNext

Selector: button[hlm-carousel-next], button[hlmCarouselNext]

Inputs

PropTypeDefaultDescription
class ClassValue --

HlmCarouselPrevious

Selector: button[hlm-carousel-previous], button[hlmCarouselPrevious]

Inputs

PropTypeDefaultDescription
class ClassValue --

HlmCarouselSlideDisplay

Selector: hlm-carousel-slide-display

Inputs

PropTypeDefaultDescription
class ClassValue --
slideClass ClassValue text-muted-foreground text-sm -
label string Slide Screen reader only text for the slide display

HlmCarousel

Selector: hlm-carousel

Inputs

PropTypeDefaultDescription
class ClassValue --
orientation 'horizontal' | 'vertical' horizontal -
options Omit<EmblaOptionsType, 'axis'> --
plugins EmblaPluginType[] [] -

Examples

Sizes

The size of the items can be set by using the basis utility class on the hlm-carousel-item .

1

2

3

4

5

Spacing

The spacing between the items can be set by using a pl-[VALUE] utility on the hlm-carousel-item and a negative -ml-[VALUE] on the hlm-carousel-content .

1

2

3

4

5

Orientation

The orientation prop can be used to set the orientation of the carousel.

1

2

3

4

5

Slide Count

Use hlm-carousel-slide-display to display the current and total slides.

1

2

3

4

5

Slide 1 of 0 is displayed

Plugins

You can use the plugins plugins prop to add plugins to the carousel.

1

2

3

4

5

See the Embla Carousel docs for more information on using plugins.

Checkbox Card