@jasonvh/carousel
v1.0.2
Published
A responsive draggable 5-card carousel component for Angular. See a [demo](carousel.vanhattum.xyz) here.
Downloads
5
Readme
Carousel Component
A responsive draggable 5-card carousel component for Angular. See a demo here.
Usage
To use this component:
Install via your favourite package manager
npm install @jasonvh/carousel
or yarn add @jasonvh/carousel
.
Import the module
// ... other imports
import { CarouselModule } from '@jasonvh/carousel';
@NgModule({
imports: [
// ... other modules
CarouselModule
],
})
export class AppModule { }
Use the component in your template
app.component.html:
<lib-carousel [items]="items"></lib-carousel>
app.component.ts:
public items = [
{ title: 'Mobile Internet', image: 'bench.png' },
{ title: 'Home Internet', image: 'glide.png' },
{ title: 'Get a device', image: 'bike.png' },
{ title: 'Add a Phone-line', image: 'gym-wall.png' },
{ title: 'Upgrade', image: 'snowmobile.png' },
];
Notes:
- Images are fetched from
/assets/<image>
. - There must be 5 items.
Known issues
- The carousel leaves some space on the right in the smallest breakpoint (1080p). This isn't a hard issue and can be fixed, it just requires significant restructuring of the HTML and CSS in the component.