Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
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...
Image Gallery
Loading...
In A Card
Loading...
Multiple Items
Loading...
Vertical
Loading...
With Indicators
Loading...
API Reference
<app-carousel>
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
id | string | undefined | generated | Unique identifier used to create the carousel part IDs. |
ids | CarouselElementIds | undefined | — | Overrides the generated IDs for individual parts. |
page | number | undefined | — | Current page when controlled. Supports Angular two-way binding. |
defaultPage | number | undefined | 0 | Initial page when uncontrolled. |
slideCount | number | 0 | Total number of slides. |
slidesPerPage | number | undefined | 1 | Number of slides visible on each page. |
slidesPerMove | number | "auto" | undefined | "auto" | Number of slides advanced per navigation action. |
autoSize | boolean | false | Sizes slides from their content instead of dividing the viewport evenly. |
loop | boolean | false | Wraps navigation from the last page to the first and vice versa. |
allowMouseDrag | boolean | false | Enables dragging with a mouse. |
autoplay | boolean | { delay: number } | undefined | false | Enables autoplay, optionally with a delay in milliseconds. |
orientation | "horizontal" | "vertical" | undefined | "horizontal" | Sets the carousel orientation. |
spacing | string | undefined | "0px" | CSS length placed between slides. |
padding | string | undefined | — | CSS scroll padding applied to the slide viewport. |
inViewThreshold | number | number[] | undefined | 0.6 | Intersection threshold used to determine whether a slide is in view. |
snapType | "proximity" | "mandatory" | undefined | "mandatory" | Sets the CSS scroll snap strictness. |
translations | CarouselIntlTranslations | undefined | built in | Overrides accessible labels and progress text. |
Use [(page)]="page" for two-way binding, or combine [page] with (pageChange) when using
signals.
Outputs
| Output | Type | Description |
|---|---|---|
pageChange | number | undefined | Emits the current page for Angular two-way binding. |
pageDetailsChange | CarouselPageChangeDetails | Emits the page index and its corresponding snap point. |
dragStatusChange | CarouselDragStatusDetails | Emits when pointer dragging starts, updates, or ends. |
autoplayStatusChange | CarouselAutoplayStatusDetails | Emits when autoplay starts, updates, or stops. |
[app-carousel-item]
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
index | number | required | Zero-based index of the slide. |
snapAlign | "start" | "center" | "end" | undefined | "start" | Alignment of the slide at its snap position. |
[app-carousel-previous] and [app-carousel-next]
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
variant | ButtonVariant | "outline" | Visual style inherited from the button API. |
size | ButtonSize | "icon-sm" | Button size inherited from the button API. |
[app-carousel-indicator]
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
index | number | required | Zero-based page index selected by the control. |
readOnly | boolean | false | Prevents the indicator from changing the page. |
[app-carousel-autoplay-indicator]
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
label | string | undefined | — | Text rendered while autoplay is active. |
fallback | string | undefined | — | Text rendered while autoplay is paused when no content exists. |
Context, Providers, and Utilities
| Export | Angular API |
|---|---|
CarouselRootProvider | Directive that provides an externally created carousel API through value. |
CarouselContext | Structural 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
| Export | Description |
|---|---|
CarouselApi | Connected carousel state and actions. |
CarouselElementIds | Overrides for generated carousel part IDs. |
CarouselIntlTranslations | Accessible labels and progress-text translations. |
CarouselPageChangeDetails | Current page index and snap point. |
CarouselDragStatusDetails | Details emitted by dragStatusChange. |
CarouselAutoplayStatusDetails | Details emitted by autoplayStatusChange. |
CarouselProgressTextDetails | Values passed to a custom progress-text translation. |
Angular
React
Solid
Svelte
Vue