Search documentation

Search the documentation and open a page.

A carousel for browsing a collection of content one or more items at a time.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/carousel

Composition

<app-carousel> ├── <div app-carousel-content> │ └── <div app-carousel-item> ├── <div app-carousel-control> (optional) │ ├── <button app-carousel-previous> │ └── <button app-carousel-next> ├── <app-carousel-indicators> (optional) │ └── generated indicators ├── <div app-carousel-indicator-group> (optional) │ └── <button app-carousel-indicator> ├── <button app-carousel-autoplay-trigger> (optional) ├── <span app-carousel-autoplay-indicator> (optional) └── <span app-carousel-progress-text> (optional)

Examples

Default

Loading...
Loading...

In A Card

Loading...

Multiple Items

Loading...

Vertical

Loading...

With Indicators

Loading...

API Reference

Inputs

InputTypeDefaultDescription
idstring | undefinedgeneratedUnique identifier used to create the carousel part IDs.
idsCarouselElementIds | undefined—Overrides the generated IDs for individual parts.
pagenumber | undefined—Current page when controlled. Supports Angular two-way binding.
defaultPagenumber | undefined0Initial page when uncontrolled.
slideCountnumber0Total number of slides.
slidesPerPagenumber | undefined1Number of slides visible on each page.
slidesPerMovenumber | "auto" | undefined"auto"Number of slides advanced per navigation action.
autoSizebooleanfalseSizes slides from their content instead of dividing the viewport evenly.
loopbooleanfalseWraps navigation from the last page to the first and vice versa.
allowMouseDragbooleanfalseEnables dragging with a mouse.
autoplayboolean | { delay: number } | undefinedfalseEnables autoplay, optionally with a delay in milliseconds.
orientation"horizontal" | "vertical" | undefined"horizontal"Sets the carousel orientation.
spacingstring | undefined"0px"CSS length placed between slides.
paddingstring | undefined—CSS scroll padding applied to the slide viewport.
inViewThresholdnumber | number[] | undefined0.6Intersection threshold used to determine whether a slide is in view.
snapType"proximity" | "mandatory" | undefined"mandatory"Sets the CSS scroll snap strictness.
translationsCarouselIntlTranslations | undefinedbuilt inOverrides accessible labels and progress text.

Outputs

OutputTypeDescription
pageChangenumber | undefinedEmits the current page for Angular two-way binding.
pageDetailsChangeCarouselPageChangeDetailsEmits the page index and its corresponding snap point.
dragStatusChangeCarouselDragStatusDetailsEmits when pointer dragging starts, updates, or ends.
autoplayStatusChangeCarouselAutoplayStatusDetailsEmits when autoplay starts, updates, or stops.

Inputs

InputTypeDefaultDescription
indexnumberrequiredZero-based index of the slide.
snapAlign"start" | "center" | "end" | undefined"start"Alignment of the slide at its snap position.

Inputs

InputTypeDefaultDescription
variantButtonVariant"outline"Visual style inherited from the button API.
sizeButtonSize"icon-sm"Button size inherited from the button API.

Inputs

InputTypeDefaultDescription
indexnumberrequiredZero-based page index selected by the control.
readOnlybooleanfalsePrevents the indicator from changing the page.

Inputs

InputTypeDefaultDescription
labelstring | undefined—Text rendered while autoplay is active.
fallbackstring | undefined—Text rendered while autoplay is paused when no content exists.

Context, Providers, and Utilities

ExportAngular API
CarouselRootProviderDirective that provides an externally created carousel API through value.
CarouselContextStructural directive [carousel-context] exposing the root API to a template.
useCarousel(options)Creates the signal-backed carousel machine inside an Angular injection context.
injectCarouselContext()Injects the nearest root carousel context.

Types

ExportDescription
CarouselApiConnected carousel state and actions.
CarouselElementIdsOverrides for generated carousel part IDs.
CarouselIntlTranslationsAccessible labels and progress-text translations.
CarouselPageChangeDetailsCurrent page index and snap point.
CarouselDragStatusDetailsDetails emitted by dragStatusChange.
CarouselAutoplayStatusDetailsDetails emitted by autoplayStatusChange.
CarouselProgressTextDetailsValues passed to a custom progress-text translation.