- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Dropdown Menu
- Empty
- Field
- Form Field
- Hover Card
- Icon
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner (Toast)
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Tooltip
Carousel
A carousel with motion and swipe built using Embla.
1
2
3
4
5
import { Component } from '@angular/core';
import { HlmCardImports } from '@spartan-ng/helm/card';
import { HlmCarouselImports } from '@spartan-ng/helm/carousel';
@Component({
selector: 'spartan-carousel-preview',
imports: [HlmCarouselImports, HlmCardImports],
template: `
<div class="flex w-full items-center justify-center p-4">
<hlm-carousel class="w-full max-w-xs">
<hlm-carousel-content>
@for (item of items; track item) {
<hlm-carousel-item>
<div class="p-1">
<section hlmCard>
<p hlmCardContent class="flex aspect-square items-center justify-center p-6">
<span class="text-4xl font-semibold">{{ item }}</span>
</p>
</section>
</div>
</hlm-carousel-item>
}
</hlm-carousel-content>
<button hlm-carousel-previous></button>
<button hlm-carousel-next></button>
</hlm-carousel>
</div>
`,
})
export class CarouselPreview {
public items = Array.from({ length: 5 }, (_, i) => i + 1);
}About
Carousel is built on top of Embla Carousel library and the embla-carousel-angular wrapper.
Installation
ng g @spartan-ng/cli:ui carouselnx g @spartan-ng/cli:ui carouselimport { DestroyRef, ElementRef, HostAttributeToken, Injector, PLATFORM_ID, effect, inject, runInInjectionContext } from '@angular/core';
import { clsx, type ClassValue } from 'clsx';
import { isPlatformBrowser } from '@angular/common';
import { twMerge } from 'tailwind-merge';
export function hlm(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
// Global map to track class managers per element
const elementClassManagers = new WeakMap<HTMLElement, ElementClassManager>();
// Global mutation observer for all elements
let globalObserver: MutationObserver | null = null;
const observedElements = new Set<HTMLElement>();
interface ElementClassManager {
element: HTMLElement;
sources: Map<number, { classes: Set<string>; order: number }>;
baseClasses: Set<string>;
isUpdating: boolean;
nextOrder: number;
hasInitialized: boolean;
restoreRafId: number | null;
/** Transitions are suppressed until the first effect writes correct classes */
transitionsSuppressed: boolean;
/** Original inline transition value to restore after suppression (empty string = none was set) */
previousTransition: string;
/** Original inline transition priority to preserve !important when restoring */
previousTransitionPriority: string;
}
let sourceCounter = 0;
/**
* This function dynamically adds and removes classes for a given element without requiring
* the a class binding (e.g. `[class]="..."`) which may interfere with other class bindings.
*
* 1. This will merge the existing classes on the element with the new classes.
* 2. It will also remove any classes that were previously added by this function but are no longer present in the new classes.
* 3. Multiple calls to this function on the same element will be merged efficiently.
*/
export function classes(computed: () => ClassValue[] | string, options: ClassesOptions = {}) {
runInInjectionContext(options.injector ?? inject(Injector), () => {
const elementRef = options.elementRef ?? inject(ElementRef);
const platformId = inject(PLATFORM_ID);
const destroyRef = inject(DestroyRef);
const baseClasses = inject(new HostAttributeToken('class'), { optional: true });
const element = elementRef.nativeElement;
// Create unique identifier for this source
const sourceId = sourceCounter++;
// Get or create the class manager for this element
let manager = elementClassManagers.get(element);
if (!manager) {
// Initialize base classes from variation (host attribute 'class')
const initialBaseClasses = new Set<string>();
if (baseClasses) {
toClassList(baseClasses).forEach((cls) => initialBaseClasses.add(cls));
}
manager = {
element,
sources: new Map(),
baseClasses: initialBaseClasses,
isUpdating: false,
nextOrder: 0,
hasInitialized: false,
restoreRafId: null,
transitionsSuppressed: false,
previousTransition: '',
previousTransitionPriority: '',
};
elementClassManagers.set(element, manager);
// Setup global observer if needed and register this element
setupGlobalObserver(platformId);
observedElements.add(element);
// Suppress transitions until the first effect writes correct classes and
// the browser has painted them. This prevents CSS transition animations
// during hydration when classes change from SSR state to client state.
if (isPlatformBrowser(platformId)) {
manager.previousTransition = element.style.getPropertyValue('transition');
manager.previousTransitionPriority = element.style.getPropertyPriority('transition');
element.style.setProperty('transition', 'none', 'important');
manager.transitionsSuppressed = true;
}
}
// Assign order once at registration time
const sourceOrder = manager.nextOrder++;
function updateClasses(): void {
// Get the new classes from the computed function
const newClasses = toClassList(computed());
// Update this source's classes, keeping the original order
manager!.sources.set(sourceId, {
classes: new Set(newClasses),
order: sourceOrder,
});
// Update the element
updateElement(manager!);
// Re-enable transitions after the first effect writes correct classes.
// Deferred to next animation frame so the browser paints the class change
// with transitions disabled first, then re-enables them.
if (manager!.transitionsSuppressed) {
manager!.transitionsSuppressed = false;
manager!.restoreRafId = requestAnimationFrame(() => {
manager!.restoreRafId = null;
restoreTransitionSuppression(manager!);
});
}
}
// Register cleanup with DestroyRef
destroyRef.onDestroy(() => {
if (manager!.restoreRafId !== null) {
cancelAnimationFrame(manager!.restoreRafId);
manager!.restoreRafId = null;
}
if (manager!.transitionsSuppressed) {
manager!.transitionsSuppressed = false;
restoreTransitionSuppression(manager!);
}
// Remove this source from the manager
manager!.sources.delete(sourceId);
// If no more sources, clean up the manager
if (manager!.sources.size === 0) {
cleanupManager(element);
} else {
// Update element without this source's classes
updateElement(manager!);
}
});
/**
* We need this effect to track changes to the computed classes. Ideally, we would use
* afterRenderEffect here, but that doesn't run in SSR contexts, so we use a standard
* effect which works in both browser and SSR.
*/
effect(updateClasses);
});
}
function restoreTransitionSuppression(manager: ElementClassManager): void {
const prev = manager.previousTransition;
if (prev) {
manager.element.style.setProperty('transition', prev, manager.previousTransitionPriority || undefined);
} else {
manager.element.style.removeProperty('transition');
}
}
// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
function setupGlobalObserver(platformId: Object): void {
if (isPlatformBrowser(platformId) && !globalObserver) {
// Create single global observer that watches the entire document
globalObserver = new MutationObserver((mutations) => {
for (const mutation of mutations) {
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
const element = mutation.target as HTMLElement;
const manager = elementClassManagers.get(element);
// Only process elements we're managing
if (manager && observedElements.has(element)) {
if (manager.isUpdating) continue; // Ignore changes we're making
// Update base classes to include any externally added classes
const currentClasses = toClassList(element.className);
const allSourceClasses = new Set<string>();
// Collect all classes from all sources
for (const source of manager.sources.values()) {
for (const className of source.classes) {
allSourceClasses.add(className);
}
}
// Any classes not from sources become new base classes
manager.baseClasses.clear();
for (const className of currentClasses) {
if (!allSourceClasses.has(className)) {
manager.baseClasses.add(className);
}
}
updateElement(manager);
}
}
}
});
// Start observing the entire document for class attribute changes
globalObserver.observe(document, {
attributes: true,
attributeFilter: ['class'],
subtree: true, // Watch all descendants
});
}
}
function updateElement(manager: ElementClassManager): void {
if (manager.isUpdating) return; // Prevent recursive updates
manager.isUpdating = true;
// Handle initialization: capture base classes after first source registration
if (!manager.hasInitialized && manager.sources.size > 0) {
// Get current classes on element (may include SSR classes)
const currentClasses = toClassList(manager.element.className);
// Get all classes that will be applied by sources
const allSourceClasses = new Set<string>();
for (const source of manager.sources.values()) {
source.classes.forEach((className) => allSourceClasses.add(className));
}
// Only consider classes as "base" if they're not produced by any source
// This prevents SSR-rendered classes from being preserved as base classes
currentClasses.forEach((className) => {
if (!allSourceClasses.has(className)) {
manager.baseClasses.add(className);
}
});
manager.hasInitialized = true;
}
// Get classes from all sources, sorted by registration order (later takes precedence)
const sortedSources = Array.from(manager.sources.entries()).sort(([, a], [, b]) => a.order - b.order);
const allSourceClasses: string[] = [];
for (const [, source] of sortedSources) {
allSourceClasses.push(...source.classes);
}
// Combine base classes with all source classes, ensuring base classes take precedence
const classesToApply =
allSourceClasses.length > 0 || manager.baseClasses.size > 0
? hlm([...allSourceClasses, ...manager.baseClasses])
: '';
// Apply the classes to the element
if (manager.element.className !== classesToApply) {
manager.element.className = classesToApply;
}
manager.isUpdating = false;
}
function cleanupManager(element: HTMLElement): void {
// Remove from global tracking
observedElements.delete(element);
elementClassManagers.delete(element);
// If no more elements being tracked, cleanup global observer
if (observedElements.size === 0 && globalObserver) {
globalObserver.disconnect();
globalObserver = null;
}
}
interface ClassesOptions {
elementRef?: ElementRef<HTMLElement>;
injector?: Injector;
}
// Cache for parsed class lists to avoid repeated string operations
const classListCache = new Map<string, string[]>();
function toClassList(className: string | ClassValue[]): string[] {
// For simple string inputs, use cache to avoid repeated parsing
if (typeof className === 'string' && classListCache.has(className)) {
return classListCache.get(className)!;
}
const result = clsx(className)
.split(' ')
.filter((c) => c.length > 0);
// Cache string results, but limit cache size to prevent memory growth
if (typeof className === 'string' && classListCache.size < 1000) {
classListCache.set(className, result);
}
return result;
}import type, { ClassValue } from 'clsx';
import { ChangeDetectionStrategy, Component, Directive, computed, effect, inject, input, signal, untracked, viewChild, type InputSignal, type Signal } from '@angular/core';
import { EmblaCarouselDirective, type EmblaEventType, type EmblaOptionsType, type EmblaPluginType } from 'embla-carousel-angular';
import { HlmButton, provideBrnButtonConfig } from '@spartan-ng/helm/button';
import { HlmIcon } from '@spartan-ng/helm/icon';
import { NgIcon, provideIcons } from '@ng-icons/core';
import { classes, hlm } from '@spartan-ng/helm/utils';
import { lucideArrowLeft, lucideArrowRight } from '@ng-icons/lucide';
@Directive({
selector: '[hlmCarouselContent],hlm-carousel-content',
host: {
'data-slot': 'carousel-content',
},
})
export class HlmCarouselContent {
private readonly _orientation = inject(HlmCarousel).orientation;
constructor() {
classes(() => ['flex', this._orientation() === 'horizontal' ? '-ml-4' : '-mt-4 flex-col']);
}
}
@Directive({
selector: '[hlmCarouselItem],hlm-carousel-item',
host: {
'data-slot': 'carousel-item',
role: 'group',
'aria-roledescription': 'slide',
},
})
export class HlmCarouselItem {
private readonly _orientation = inject(HlmCarousel).orientation;
constructor() {
classes(() => ['min-w-0 shrink-0 grow-0 basis-full', this._orientation() === 'horizontal' ? 'pl-4' : 'pt-4']);
}
}
@Component({
selector: 'button[hlm-carousel-next], button[hlmCarouselNext]',
imports: [NgIcon, HlmIcon],
providers: [provideIcons({ lucideArrowRight }), provideBrnButtonConfig({ variant: 'outline', size: 'icon' })],
changeDetection: ChangeDetectionStrategy.OnPush,
hostDirectives: [{ directive: HlmButton, inputs: ['variant', 'size'] }],
host: {
'data-slot': 'carousel-next',
'[disabled]': 'isDisabled()',
'(click)': '_carousel.scrollNext()',
},
template: `
<ng-icon hlm size="sm" name="lucideArrowRight" />
<span class="sr-only">Next slide</span>
`,
})
export class HlmCarouselNext {
private readonly _button = inject(HlmButton);
protected readonly _carousel = inject(HlmCarousel);
private readonly _computedClass = computed(() =>
hlm(
'absolute h-8 w-8 rounded-full',
this._carousel.orientation() === 'horizontal'
? 'top-1/2 -right-12 -translate-y-1/2'
: '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',
),
);
protected readonly isDisabled = () => !this._carousel.canScrollNext();
constructor() {
effect(() => {
const computedClass = this._computedClass();
untracked(() => this._button.setClass(computedClass));
});
}
}
@Component({
selector: 'button[hlm-carousel-previous], button[hlmCarouselPrevious]',
imports: [NgIcon, HlmIcon],
providers: [provideIcons({ lucideArrowLeft }), provideBrnButtonConfig({ variant: 'outline', size: 'icon' })],
changeDetection: ChangeDetectionStrategy.OnPush,
hostDirectives: [{ directive: HlmButton, inputs: ['variant', 'size'] }],
host: {
'data-slot': 'carousel-previous',
'[disabled]': 'isDisabled()',
'(click)': '_carousel.scrollPrev()',
},
template: `
<ng-icon hlm size="sm" name="lucideArrowLeft" />
<span class="sr-only">Previous slide</span>
`,
})
export class HlmCarouselPrevious {
private readonly _button = inject(HlmButton);
protected readonly _carousel = inject(HlmCarousel);
private readonly _computedClass = computed(() =>
hlm(
'absolute h-8 w-8 rounded-full',
this._carousel.orientation() === 'horizontal'
? 'top-1/2 -left-12 -translate-y-1/2'
: '-top-12 left-1/2 -translate-x-1/2 rotate-90',
),
);
protected readonly isDisabled = () => !this._carousel.canScrollPrev();
constructor() {
effect(() => {
const computedClass = this._computedClass();
untracked(() => this._button.setClass(computedClass));
});
}
}
@Component({
selector: 'hlm-carousel-slide-display',
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
'data-slot': 'carousel-slide-display',
},
template: `
<span class="sr-only">{{ _labelContent() }}</span>
<div aria-hidden="true" [class]="slideClass()">{{ _currentSlide() }} / {{ _carousel.slideCount() }}</div>
`,
})
export class HlmCarouselSlideDisplay {
protected readonly _carousel = inject(HlmCarousel);
protected readonly _currentSlide = computed(() => this._carousel.currentSlide() + 1);
public readonly slideClass = input<ClassValue>('text-muted-foreground text-sm');
/** Screen reader only text for the slide display */
public readonly label = input<string>('Slide');
protected readonly _labelContent = computed(() => {
const currentSlide = this._currentSlide();
const slideCount = this._carousel.slideCount();
return `${this.label()} ${currentSlide} of ${slideCount} is displayed`;
});
}
@Component({
selector: 'hlm-carousel',
imports: [EmblaCarouselDirective],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
'data-slot': 'carousel',
role: 'region',
'aria-roledescription': 'carousel',
'(keydown)': 'onKeydown($event)',
},
template: `
<div
emblaCarousel
class="overflow-hidden"
[plugins]="plugins()"
[options]="_emblaOptions()"
[subscribeToEvents]="['init', 'select', 'reInit']"
(emblaChange)="onEmblaEvent($event)"
>
<ng-content select="[hlmCarouselContent],hlm-carousel-content" />
</div>
<ng-content />
`,
})
export class HlmCarousel {
protected readonly _emblaCarousel = viewChild.required(EmblaCarouselDirective);
public readonly orientation = input<'horizontal' | 'vertical'>('horizontal');
public readonly options: InputSignal<Omit<EmblaOptionsType, 'axis'> | undefined> =
input<Omit<EmblaOptionsType, 'axis'>>();
public readonly plugins: InputSignal<EmblaPluginType[]> = input<EmblaPluginType[]>([]);
protected readonly _emblaOptions: Signal<EmblaOptionsType> = computed(() => ({
...this.options(),
axis: this.orientation() === 'horizontal' ? 'x' : 'y',
}));
private readonly _canScrollPrev = signal(false);
public readonly canScrollPrev = this._canScrollPrev.asReadonly();
private readonly _canScrollNext = signal(false);
public readonly canScrollNext = this._canScrollNext.asReadonly();
private readonly _currentSlide = signal(0);
public readonly currentSlide = this._currentSlide.asReadonly();
private readonly _slideCount = signal(0);
public readonly slideCount = this._slideCount.asReadonly();
constructor() {
classes(() => 'relative');
}
protected onEmblaEvent(event: EmblaEventType) {
const emblaApi = this._emblaCarousel().emblaApi;
if (!emblaApi) {
return;
}
if (event === 'select' || event === 'init' || event === 'reInit') {
this._canScrollPrev.set(emblaApi.canScrollPrev());
this._canScrollNext.set(emblaApi.canScrollNext());
this._currentSlide.set(emblaApi.selectedScrollSnap());
this._slideCount.set(emblaApi.scrollSnapList().length);
}
}
protected onKeydown(event: KeyboardEvent) {
if (event.key === 'ArrowLeft') {
event.preventDefault();
this._emblaCarousel().scrollPrev();
} else if (event.key === 'ArrowRight') {
event.preventDefault();
this._emblaCarousel().scrollNext();
}
}
scrollPrev() {
this._emblaCarousel().scrollPrev();
}
scrollNext() {
this._emblaCarousel().scrollNext();
}
}
export const HlmCarouselImports = [
HlmCarousel,
HlmCarouselContent,
HlmCarouselItem,
HlmCarouselPrevious,
HlmCarouselNext,
HlmCarouselSlideDisplay,
] as const;Usage
import { HlmCarouselImports } 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>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
import { Component } from '@angular/core';
import { HlmCardImports } from '@spartan-ng/helm/card';
import { HlmCarouselImports } from '@spartan-ng/helm/carousel';
@Component({
selector: 'spartan-carousel-sizes',
imports: [HlmCarouselImports, HlmCardImports],
template: `
<div class="flex w-full items-center justify-center p-4">
<hlm-carousel class="w-full max-w-sm">
<hlm-carousel-content>
@for (item of items; track item) {
<hlm-carousel-item class="md:basis-1/2 lg:basis-1/3">
<div class="p-1">
<section hlmCard>
<p hlmCardContent class="flex aspect-square items-center justify-center p-6">
<span class="text-3xl font-semibold">{{ item }}</span>
</p>
</section>
</div>
</hlm-carousel-item>
}
</hlm-carousel-content>
<button hlm-carousel-previous></button>
<button hlm-carousel-next></button>
</hlm-carousel>
</div>
`,
})
export class CarouselSizes {
public items = Array.from({ length: 5 }, (_, i) => i + 1);
}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
import { Component } from '@angular/core';
import { HlmCardImports } from '@spartan-ng/helm/card';
import { HlmCarouselImports } from '@spartan-ng/helm/carousel';
@Component({
selector: 'spartan-carousel-spacing',
imports: [HlmCarouselImports, HlmCardImports],
template: `
<div class="flex w-full items-center justify-center p-4">
<hlm-carousel class="w-full max-w-sm">
<hlm-carousel-content class="-ml-1">
@for (item of items; track item) {
<hlm-carousel-item class="pl-1 md:basis-1/2 lg:basis-1/3">
<div class="p-1">
<section hlmCard>
<p hlmCardContent class="flex aspect-square items-center justify-center p-6">
<span class="text-2xl font-semibold">{{ item }}</span>
</p>
</section>
</div>
</hlm-carousel-item>
}
</hlm-carousel-content>
<button hlm-carousel-previous></button>
<button hlm-carousel-next></button>
</hlm-carousel>
</div>
`,
})
export class CarouselSpacing {
public items = Array.from({ length: 5 }, (_, i) => i + 1);
}Orientation
The orientation prop can be used to set the orientation of the carousel.
1
2
3
4
5
import { Component } from '@angular/core';
import { HlmCardImports } from '@spartan-ng/helm/card';
import { HlmCarouselImports } from '@spartan-ng/helm/carousel';
@Component({
selector: 'spartan-carousel-orientation',
imports: [HlmCarouselImports, HlmCardImports],
host: {
class: 'w-full',
},
template: `
<div class="flex w-full items-center justify-center p-4">
<hlm-carousel class="w-full max-w-xs" orientation="vertical">
<hlm-carousel-content class="-mt-1 h-[200px]">
@for (item of items; track item) {
<hlm-carousel-item class="pt-1 md:basis-1/2">
<div class="p-1">
<section hlmCard>
<p hlmCardContent class="flex items-center justify-center p-6">
<span class="text-3xl font-semibold">{{ item }}</span>
</p>
</section>
</div>
</hlm-carousel-item>
}
</hlm-carousel-content>
<button hlm-carousel-previous></button>
<button hlm-carousel-next></button>
</hlm-carousel>
</div>
`,
})
export class CarouselOrientation {
public items = Array.from({ length: 5 }, (_, i) => i + 1);
}Slide Count
Use hlm-carousel-slide-display to display the current and total slides.
1
2
3
4
5
import { Component } from '@angular/core';
import { HlmCardImports } from '@spartan-ng/helm/card';
import { HlmCarouselImports } from '@spartan-ng/helm/carousel';
@Component({
selector: 'spartan-carousel-slide-count',
imports: [HlmCarouselImports, HlmCardImports],
template: `
<div class="flex w-full items-center justify-center p-4">
<hlm-carousel class="w-full max-w-xs">
<hlm-carousel-content>
@for (item of items; track item) {
<hlm-carousel-item>
<div class="p-1">
<section hlmCard>
<p hlmCardContent class="flex aspect-square items-center justify-center p-6">
<span class="text-4xl font-semibold">{{ item }}</span>
</p>
</section>
</div>
</hlm-carousel-item>
}
</hlm-carousel-content>
<button hlm-carousel-previous></button>
<button hlm-carousel-next></button>
<hlm-carousel-slide-display class="mt-1 flex justify-end" />
</hlm-carousel>
</div>
`,
})
export class CarouselSlideCount {
public items = Array.from({ length: 5 }, (_, i) => i + 1);
}Plugins
You can use the plugins plugins prop to add plugins to the carousel.
1
2
3
4
5
import { Component } from '@angular/core';
import { HlmCardImports } from '@spartan-ng/helm/card';
import { HlmCarouselImports } from '@spartan-ng/helm/carousel';
import Autoplay from 'embla-carousel-autoplay';
@Component({
selector: 'spartan-carousel-plugins',
imports: [HlmCarouselImports, HlmCardImports],
template: `
<div class="flex w-full items-center justify-center p-4">
<hlm-carousel class="w-full max-w-xs" [plugins]="plugins">
<hlm-carousel-content>
@for (item of items; track item) {
<hlm-carousel-item>
<div class="p-1">
<section hlmCard>
<p hlmCardContent class="flex aspect-square items-center justify-center p-6">
<span class="text-4xl font-semibold">{{ item }}</span>
</p>
</section>
</div>
</hlm-carousel-item>
}
</hlm-carousel-content>
<button hlm-carousel-previous></button>
<button hlm-carousel-next></button>
</hlm-carousel>
</div>
`,
})
export class CarouselPlugins {
public items = Array.from({ length: 5 }, (_, i) => i + 1);
public plugins = [Autoplay({ delay: 3000 })];
}See the Embla Carousel docs for more information on using plugins.
Helm API
HlmCarouselContent
Selector: [hlmCarouselContent],hlm-carousel-content
HlmCarouselItem
Selector: [hlmCarouselItem],hlm-carousel-item
HlmCarouselNext
Selector: button[hlm-carousel-next], button[hlmCarouselNext]
HlmCarouselPrevious
Selector: button[hlm-carousel-previous], button[hlmCarouselPrevious]
HlmCarouselSlideDisplay
Selector: hlm-carousel-slide-display
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| slideClass | ClassValue | text-muted-foreground text-sm | - |
| label | string | Slide | Screen reader only text for the slide display |
HlmCarousel
Selector: hlm-carousel
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| orientation | 'horizontal' | 'vertical' | horizontal | - |
| options | Omit<EmblaOptionsType, 'axis'> | - | - |
| plugins | EmblaPluginType[] | [] | - |
On This Page