rm-image-slider

July 4, 2026 · View on GitHub

npm version Production ready license Angular support range Ivy compatible Standalone API AOT compatible SSR compatible Strict TS Tree-shakable No side effects Linting Tests Coverage Accessibility compliant API docs Examples No dependencies total downloads Last update Maintained SemVer

See It In Action

rm-image-slider Demo

Experience the power: Image carousel, lightbox popup, video support, and touch gestures - all in one lightweight component!


An Angular responsive image slider with lightbox popup. Also support youtube and mp4 video urls. It is lazy loading and highly optimized with standalone component.


Features!

  • Responsive (support images width and height in both % and px)
  • captures swipes from phones and tablets
  • Compatible with Angular Universal
  • Image lightbox popup
  • captures keyboard next/previous arrow key event for lightbox image move
  • Support Images (jpeg, jpg, gif, png and Base64-String), Youtube url and MP4 video (url and Base64-String)
  • Handling runtime image arraylist changes

Live Demo & Playground

StackBlitz Demo

Interactive Playground
Try all features live in your browser
Examples

Complete Examples
Copy-paste ready code samples
npm Package

npm Registry
Install and view package details
GitHub Repository

Source Code
Star, fork, and contribute

Quick Start

Install rm-image-slider with npm and yarn


  npm: npm install rm-image-slider --save 

  yarn: yarn add rm-image-slider

Setup :

Import module in your component:

import { RmImageSliderComponent, ImageObject } from 'rm-image-slider';
...
@Component({
  selector: '',
  imports: [RmImageSliderComponent],
  templateUrl: '',
  styleUrl: '',
})

Add component in your template file.

<rm-image-slider [images]="imageObject" #nav></rm-image-slider>

ImageObject format

imageObject: Array<ImageObject> = [{
  image: 'assets/img/slider/1.jpg',
  thumbImage: 'assets/img/slider/1_min.jpeg',
  alt: 'alt of image',
  title: 'title of image',
  index: 1
}, {
  image: '.../iOe/xHHf4nf8AE75h3j1x64ZmZ//Z==', // Support base64 image
  thumbImage: '.../iOe/xHHf4nf8AE75h3j1x64ZmZ//Z==', // Support base64 image
  title: 'Image title', //Optional: You can use this key if want to show image with title
  alt: 'Image alt', //Optional: You can use this key if want to show image with alt
  order: 1, //Optional: if you pass this key then slider images will be arrange according @input: slideOrderType
  index: 2
}
];

Image, Youtube and MP4 url's object format

imageObject: Array<ImageObject> = [{
  video: 'https://youtu.be/....' // Youtube url
  index: 1
},
  {
    video: 'assets/video/********.mp4', // MP4 Video url
    index: 2
  },
  {
    video: 'assets/video/movie2.mp4',
    posterImage: 'assets/img/slider/2_min.jpeg', //Optional: You can use this key if you want to show video poster image in slider
    title: 'Image title',
    index: 3
  },
  {
    image: 'assets/img/slider/1.jpg',
    thumbImage: 'assets/img/slider/1_min.jpeg',
    alt: 'Image alt',
    index: 4
  }
  ...
];

API Reference (optional) :

NameTypeData TypeDescriptionDefault
infinite@InputbooleanInfinite sliding images if value is true.false
imagePopup@InputbooleanEnable image lightBox popup option on slider image click.true
animationSpeed@InputnumberBy this user can set slider animation speed. Minimum value is 0.1 second and Maximum value is 5 second.1
slideImage@InputnumberSet how many images will move on left/right arrow click.1
imageSize@InputobjectSet slider images width, height and space. space is use for set space between slider images. Pass object like {width: '400px', height: '300px', space: 4} or you can pass value in percentage {width: '20%', height: '20%'} OR set only space {space: 4}{width: 205, height: 200, space: 3}
manageImageRatio@InputbooleanShow images with aspect ratio if value is true and set imageSize width and height on parent divfalse
autoSlide@Inputnumber/boolean/objectAuto slide images according provided time interval. Option will work only if infinite option is true. For number data type minimum value is 1 second and Maximum value is 5 second. By object data type you can prevent auto slide stop behaviour on mouse hover event. {interval: 2, stopOnHover: false}0
showArrow@InputbooleanHide/Show slider arrow buttonstrue
arrowKeyMove@InputbooleanDisable slider and popup image left/right move on arrow key press event, if value is falsetrue
videoAutoPlay@InputbooleanAuto play popup videofalse
showVideoControls@InputbooleanHide video control if value is falsetrue
direction@InputstringSet text direction. You can pass rtl / ltr / autoltr
slideOrderType@InputstringArrange slider images in Ascending order by ASC and in Descending order by DESC. order key must be exist with image object.ASC
lazyLoading@InputbooleanLazy load images and Iframe if true.false
defaultActiveImage@InputnumberSet image as selected on load.null
imageClick@Outputn/aExecutes when click event on slider image. Return image index.n/a
arrowClick@Outputn/aExecutes when click on slider left/right arrow. Returns current event name and next/previous button disabled status.n/a
lightboxClose@Outputn/aExecutes when lightbox close.n/a
lightboxArrowClick@Outputn/aExecutes when click on lightbox next/previous arrow.n/a

Add custom navigation button

import { Component, ViewChild } from '@angular/core';
import { RmImageSliderComponent } from 'rm-image-slider';

@Component({
  selector: 'sample',
  standalone: true,
  imports: [RmImageSliderComponent],
  template:`
        <rm-image-slider [images]="imageObject" #nav>
        </rm-image-slider>
        <button (click)="prevImageClick()">Prev</button>
        <button (click)="nextImageClick()">Next</button>
        `
})
class Sample {
  @ViewChild('nav') slider: RmImageSliderComponent;
  imageObject = [{...}]

  prevImageClick() {
    this.slider.prev();
  }

  nextImageClick() {
    this.slider.next();
  }
}

Development Setup

git clone https://github.com/malikrajat/rm-image-slider.git
cd rm-rm-image-slider
pnpm install
pnpm start  # Serves test app on localhost:4200


Changelog

See CHANGELOG.md for release history and updates.


Latest Release

Check the releases page for the most recent version and updates.


License

This project is licensed under the MIT License - see the LICENSE file for details.

TL;DR: You can use this library freely in commercial and personal projects.

MIT License Summary

You can:

  • Use commercially
  • Modify the code
  • Distribute
  • Use privately

You must:

  • Include the license and copyright notice

You cannot:

  • Hold the author liable

FAQ

General

Q: How do I install rm-image-slider?

A: Install via npm or yarn:

npm install rm-image-slider --save
# or
yarn add rm-image-slider

Q: What Angular versions are supported?

A: Angular 14 to 18+ are supported. The component is standalone and works with Ivy.

Q: Does it work with SSR (Angular Universal)?

A: Yes, rm-image-slider is fully compatible with Angular Universal.

Images & Media

Q: What image formats are supported?

A: Images (jpeg, jpg, gif, png) and Base64-encoded strings are supported.

Q: Can I use YouTube videos?

A: Yes, pass a YouTube URL in the video property of the image object.

Q: How do I add MP4 videos?

A: Use the video property for MP4 URLs. You can also set a posterImage to show a thumbnail in the slider.

Q: How do I enable lazy loading?

A: Set [lazyLoading]="true" on the component. Images will load only when they come into view.

Q: How do I disable the lightbox popup?

A: Set [imagePopup]="false" to disable the lightbox on image click.

Q: Can I navigate slides programmatically?

A: Yes, use @ViewChild to get a reference and call .prev() or .next() methods.

Q: How do I change the arrow key behavior?

A: Set [arrowKeyMove]="false" to disable keyboard navigation.

Customization

Q: How do I change the slider direction (RTL/LTR)?

A: Use the direction input: [direction]="'rtl'" or "ltr". Default is "ltr".

Q: How do I set custom image dimensions?

A: Use the imageSize input: [imageSize]="{width: '400px', height: '300px', space: 4}".

Q: How do I enable infinite looping?

A: Set [infinite]="true". Note: auto-slide only works when infinite is enabled.

Q: How do I arrange images in a specific order?

A: Add an order property to each image object and set [slideOrderType]="'ASC'" or "DESC".


Browser Compatibility

Supported Browsers

BrowserVersionSupport LevelNotes
Chrome80+Full SupportRecommended browser
Firefox75+Full SupportWorks perfectly
Safari13+Full SupportiOS and macOS
Edge80+Full SupportChromium-based
Opera67+Full SupportWorks well
Samsung Internet12+Full SupportMobile support

Mobile Support

  • iOS Safari 13+
  • Chrome for Android 80+
  • Samsung Internet
  • All mobile browsers with modern JavaScript support

Download Behavior by Platform

PlatformBehavior
Desktop Chrome/Firefox/EdgeDirect download to Downloads folder
Desktop SafariMay prompt for download location
iOS SafariOpens download manager
Android ChromeDownloads to Downloads folder
Mobile SafariShows share sheet with save option

Not Supported

  • Internet Explorer (all old versions)
  • Very old mobile browsers (pre-2019)

Statistics

npm downloads npm version GitHub issues GitHub stars License


Support This Project

If rm-image-slider has helped you build better Angular applications, please consider:

If this library has saved you development time and helped create amazing image sliders in your projects, please consider giving it a star!

Why star this repo?

  • Help other developers discover this lightweight, optimized solution
  • Support continued development and improvements
  • Show appreciation for free, quality tools
  • Boost visibility in the Angular community
  • Increases visibility in the Angular community
  • Supports ongoing development and maintenance
  • Encourages more open-source contributions
  • Helps other developers find quality tools

Want More Quality Libraries?

This is just one of several useful libraries I've created. Explore my other Angular & web development libraries that might solve your next challenge:

  • Utility libraries for common development tasks
  • UI components for better user experiences
  • Performance tools for optimization
  • Mobile-friendly solutions for responsive apps

Found them helpful? A star on each repo you find useful helps tremendously! It takes just one click but means the world to open-source maintainers.

GitHub GitHub followers GitHub stars


Support and Community

Getting Help

Need assistance? We're here to help!

Support ChannelLinkBest For
Bug ReportsReport BugTechnical issues
Feature RequestsRequest FeatureNew features
DiscussionsJoin DiscussionGeneral questions
Emailmr.rajatmalik@gmail.comDirect support

Documentation

Community

  • Star the repository to show support
  • Watch for updates and new releases
  • Share your use cases and feedback
  • Contribute code or documentation

Stay Updated

  • Follow the project on GitHub
  • Star the repository for updates
  • Watch for new releases

Acknowledgments

This library was created to provide a simple, lightweight solution for Image slider in Angular applications. Special thanks to the Angular community for their feedback and contributions.

Special thanks to:

  • Angular Team - Amazing framework and ecosystem
  • Contributors - Thank you for making this library better
  • Community - For feedback and feature requests

Other Libraries

UI Components

LibraryDescriptionnpm Link
rm-range-sliderLightweight two-thumb range slider with tooltips and color customizationnpm
rm-ng-range-sliderAngular-specific version of the dual range slidernpm
rm-carouselSimple, responsive carousel componentnpm
rm-image-sliderMinimal image slider with smooth transitionsnpm
rm-ng-star-ratingConfigurable Angular star rating component with readonly modenpm
@codewithrajat/rm-ng-typeaheadAngular autocomplete/typeahead component with search suggestions and keyboard navigationGitHub
@codewithrajat/rm-ng-editorRich text editor component for Angular applications with customizable toolbar supportGitHub

PDF & Export Libraries

LibraryDescriptionnpm Link
rm-ng-export-to-csvExport JSON data to CSV with zero dependenciesnpm
@codewithrajat/rm-ng-pdf-exportImage-based PDF export tool for Angular applicationsnpm
@codewithrajat/rm-ng-structure-pdfGenerate structured PDFs for reports, invoices, or documentsnpm
@codewithrajat/rm-ng-pdf-viewerAngular PDF viewer component with zoom, navigation, and document rendering supportGitHub

Chrome Extension

LibraryDescriptionLink
quickocrChrome extension that extracts text from images using OCR technologyGitHub
readLoudeChrome extension that read you web page loude e.g article etc.GitHub
ai-assistant-replyAI Chrome extension to auto generate reply on linked in posts.GitHub

VS Code Extension

LibraryDescriptionLink
dead-css-cleanerVS Code extension for identifying and cleaning unused CSS stylesGitHub
file-coverage-insightVS Code extension for auto generated component file coverage automatelly on open.GitHub

Desktop Applications - All Plateform

LibraryDescriptionLink
deepworkCross-platform productivity application for focus sessions and deep work trackingGitHub
JsSandboxCross-platform JavaScript playground and code execution environmentGitHub

Device Detection

LibraryDescriptionnpm Link
rm-ng-device-detectionDetect device type, OS, and browser in Angularnpm

Notifications

LibraryDescriptionnpm Link
rm-pushnotifyLightweight push-style toast notification utilitynpm
rm-toast-notificationCross-platform toast and desktop notification library for web, Angular, and desktop applicationsGitHub

Layout & Dynamic Rendering

LibraryDescriptionLink
rm-ng-dynamic-layoutDynamic layout rendering engine for Angular applications using JSON-driven UI configurationGitHub

Developer Tools & Extensions

LibraryDescriptionLink
rm-colorful-console-loggerStructured and colorized console logging utility for developersnpm

Meta & Personal Branding

LibraryDescriptionnpm Link
about-rajatDeveloper portfolio package for branding and quick personal infonpm

All Packages

Browse all my packages:


Author

Rajat Malik

Full‑Stack Developer and Frontend Architect at Siemens with 14+ years building scalable enterprise platforms, specializing in micro‑frontends, AI‑native development, React, and Angular.
Author of 10+ open‑source libraries and 100+ technical articles, driving innovation through developer‑friendly tools, performance optimization, and AI‑assisted workflows.

GET IN TOUCH

SOCIAL PRESENCE

CONTENT & WRITING


Made with care and love by Rajat Malik for the Angular community

Star on GitHubView on npmReport Issue

Made with dedication by Rajat Malik