🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

ngx-carousel-slider

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-carousel-slider

[![npm version](https://badge.fury.io/js/@thouet%2Fmaterial-carousel.svg)](https://badge.fury.io/js/@thouet%2Fmaterial-carousel) [![Live demo](https://img.shields.io/badge/demo-blue.svg)](https://thouet-sigma.github.io/material2-carousel/)

14.2.14
latest
Source
npm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

npm version Live demo

Material2 Carousel

EXTRA NOTICE

This version has been further forked to upgrade it to use Angular 14.

Originally from : https://github.com/kdeenanauth/material2-carousel

Then from : https://github.com/adamkasper/material2-carousel

NOTICE

About

This package is a carousel component for Angular using Material Design.

Installing

npm install --save @thouet/material-carousel

Importing

//...
import { MatCarouselModule } from '@thouet/material-carousel';

@NgModule({
  // ...
  imports: [
    // ...
    MatCarouselModule.forRoot(),
    // ...
  ]
})
export class AppModule {}

Usage

MatCarouselComponent

import { MatCarousel, MatCarouselComponent } from '@thouet/material-carousel';
<mat-carousel>
  ...
</mat-carousel>

Attributes

InputTypeDescriptionDefault value
timingsstringTimings for slide animation.'250ms ease-in'
autoplaybooleanEnable automatic sliding.true
intervalnumberAutoplay's interval in milliseconds.5000
loopbooleanEnable loop through arrows.true
hideArrowsbooleanHide navigation arrows.true
hideIndicatorsbooleanHide navigation indicators.true
colorThemePaletteColor palette from Material.'accent'
maxWidthstringMaximum width.'auto'
maintainAspectRatiobooleanIf true, use proportion to determine height, else slideHeight is used.true
proportionnumberHeight proportion compared to width.25
slideHeightstringExplicit slide height. Used when maintainAspectRatio is false.'100%'
slidesnumberMaximum amount of displayed slides.
useKeyboardbooleanEnable keyboard navigation.false
useMouseWheelbooleanEnable navigation through mouse wheeling.false
orientationOrientationOrientation of the sliding panel.'ltr'
svgIconOverridesSvgIconOverridesOverride default carousel icons with registered SVG icons.
pauseOnHoverbooleanOverride default pause on hover.true
OutputTypeDescription
animationStartnumberIt emits the currentIndex when animation starts
changenumberIt emtis the currentIndex when animation ends

Size Considerations and Recommendations

By default, maintainAspectRatio is true, which means height is controlled through proportion.

If you want to have a carousel with constant height (regardless of width), you must set maintainAspectRatio to false.

By default, slideHeight is set to 100%, which will not work if the parent element height isn't defined (i.e. relative heights do not work if the parent height is auto). In that case you could pass a valid css string for slideHeight. You can use any valid css height string like 100px or 25vh.

Play around with the demo to see how you can use this carousel with or without explicit parent height.

With parent elements that have height:auto

  • use proportion if you want a carousel that resizes responsively (this is the default configuration).
  • use maintainAspectRatio="false" and a non-percentage slideHeight if you want a fixed height carousel.
  • DO NOT use relative (%) values for slideHeight; the carousel will not render.

With parent elements that have a set height

  • use maintainAspectRatio="false" if you want a fixed height carousel that fills the parent element (slideHeight is 100% by default).
  • DO NOT use maintainAspectRatio="false" and slideHeight (unless slideHeight="100%"); the carousel will not render correctly because the buttons and indicators will be positioned with respect to the parent.
  • DO NOT use proportion; this will lead to gaps or unwanted overflow.

MatCarouselSlideComponent

import { MatCarouselSlide, MatCarouselSlideComponent } from '@thouet/material-carousel';
<mat-carousel>
  <mat-carousel-slide>
    ...
  </mat-carousel-slide>
</mat-carousel>

Attributes

InputTypeDescriptionDefault value
imagestringImage displayed in the slide.
overlayColorstringColor of the slide's overlay.'#00000040'
hideOverlaybooleanToggle overlay on/off.false
disabledbooleanSkip slide when navigating.false

Contributing

How to help

How to develop and test

Testing

ng test carousel --watch false

Running the demo application

ng serve demo --source-map

Keywords

slide

FAQs

Package last updated on 08 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts