Angular Integration

Pagiflow Angular
Documentation

Official Angular slider and carousel documentation for Pagiflow. Learn setup, standalone components, Signals composable usage, methods, events, responsive options, thumbnails, sync, and accessibility-friendly patterns.

30+ Options
12+Methods
0Dependencies
Possibilities

Angular Integration

Install and use Pagiflow in Angular with pagiflow/angular.

Install
npm i pagiflow
Basic Usage

Import PagiflowComponent and PagiflowSlideComponent into your standalone component.

import { Component } from '@angular/core';
import { PagiflowComponent, PagiflowSlideComponent } from 'pagiflow/angular';

@Component({
  selector: 'app-slider',
  standalone: true,
  imports: [PagiflowComponent, PagiflowSlideComponent],
  template: `
    <pf-pagiflow [options]="{ loop: true, nav: true }">
      <!-- Recommended: Use pf-slide as an attribute to avoid extra DOM wrappers -->
      <div pf-slide class="slide-card">Slide 1</div>
      <div pf-slide class="slide-card">Slide 2</div>
      <div pf-slide class="slide-card">Slide 3</div>
    </pf-pagiflow>
  `
})
export class SliderComponent {}
Element vs Attribute (Important)

Pagiflow Angular allows you to use pf-slide in two ways. We strongly recommend using it as an attribute to keep your DOM clean and ensure your custom CSS layouts (like flex/grid) work flawlessly without hidden wrappers.

Recommended: Attribute Approach

Produces 0 extra wrappers. Keeps your DOM perfectly clean.

<!-- Clean output -->
<div pf-slide class="my-card">...</div>

<!-- Great for images -->
<img pf-slide src="slide.jpg" />
Alternative: Element Approach

Creates an extra <pf-slide> element in the DOM.

<!-- Adds an extra wrapper -->
<pf-slide>
  <div class="my-card">...</div>
</pf-slide>
Component Inputs
<pf-pagiflow
  [options]="sliderOptions"
  className="my-slider"
  [style]="{ '--pf-accent': '#0ea5e9' }"
>
  <pf-slide className="hero-slide" [style]="{ padding: '12px' }">Slide 1</pf-slide>
  <pf-slide>Slide 2</pf-slide>
</pf-pagiflow>

pf-pagiflow supports options, className, and style inputs. pf-slide supports className and style.

Composable (usePagiflow)

The usePagiflow utility leverages Angular Signals for a reactive, headless integration.

import { Component, ElementRef, viewChild } from '@angular/core';
import { usePagiflow } from 'pagiflow/angular';

@Component({
  template: `
    <div class="controls">
      <button (click)="pf.prev()">Prev</button>
      <span>Active: {{ pf.currentIndex() + 1 }}</span>
      <button (click)="pf.next()">Next</button>
    </div>

    <div #slider class="pagiflow">
      <div class="pf-slide">1</div>
      <div class="pf-slide">2</div>
    </div>
  `
})
export class CustomSliderComponent {
  pf = usePagiflow({ loop: true });
  sliderEl = viewChild<ElementRef>('slider');

  constructor() {
    // Attach the element to the signal
    effect(() => {
      const el = this.sliderEl()?.nativeElement;
      if (el) this.pf.sliderRef.set(el);
    });
  }
}
Complete Example

Full standalone component example with inputs, events, methods, thumbnails, and getInstance().

import { Component, ViewChild } from '@angular/core';
import { PagiflowComponent, PagiflowSlideComponent, PagiflowOptions } from 'pagiflow/angular';

@Component({
  selector: 'app-pagiflow-demo',
  standalone: true,
  imports: [PagiflowComponent, PagiflowSlideComponent],
  template: `
    <pf-pagiflow
      #pf
      [options]="options"
      className="product-slider"
      (ready)="onReady()"
      (slideChange)="onSlideChange($event)"
    >
      <pf-slide className="slide-card" [style]="{ padding: '16px' }">Slide 1</pf-slide>
      <pf-slide className="slide-card" [style]="{ padding: '16px' }">Slide 2</pf-slide>
      <pf-slide className="slide-card" [style]="{ padding: '16px' }">Slide 3</pf-slide>
      <pf-slide className="slide-card" [style]="{ padding: '16px' }">Slide 4</pf-slide>
    </pf-pagiflow>

    <div style="margin-top:12px; display:flex; gap:8px;">
      <button (click)="pf?.prev()">Prev</button>
      <button (click)="pf?.next()">Next</button>
      <button (click)="pf?.goTo(0, { instant: true })">Go First</button>
      <button (click)="logInstance()">getInstance()</button>
    </div>
  `
})
export class PagiflowDemoComponent {
  @ViewChild('pf') pf?: PagiflowComponent;

  options: PagiflowOptions = {
    loop: true,
    nav: true,
    paginate: true,
    itemsPerSlide: 1,
    gap: 12,
    autoplay: true,
    autoplayDelay: 2500,
    thumbnails: {
      enabled: true,
      position: 'bottom',
      thumbWidth: '90px',
      gap: '8px'
    }
  };

  onReady() {
    console.log('Pagiflow ready');
  }

  onSlideChange(index: number) {
    console.log('Active index:', index);
  }

  logInstance() {
    const instance = this.pf?.getInstance();
    console.log('Raw instance:', instance);
  }
}

Why Pagiflow for Angular

Built for developers who need a modern Angular slider/carousel with simple setup and full control.

  • Standalone component support with pf-pagiflow and pf-slide.
  • Signals-ready composable API via usePagiflow.
  • Rich options: loop, autoplay, pagination, thumbnails, sync, grid, center mode, RTL, and responsive breakpoints.
  • Imperative methods for programmatic control: navigation, re-init, runtime options updates, and instance access.
  • Works for product sliders, testimonial carousels, galleries, hero banners, and touch-friendly mobile UI.

Options usage

Pass configuration through the [options] input.

Input Props
sliderOptions = {
  itemsPerSlide: 3,
  gap: 20,
  autoplay: true,
  responsive: {
    768: { itemsPerSlide: 1 }
  }
};
<pf-pagiflow [options]="sliderOptions">...</pf-pagiflow>

Thumbnail Navigation

Enable synchronized thumbnails via the options object.

Thumbnails bottom
<pf-pagiflow 
  [options]="{
    loop: true,
    thumbnails: {
      enabled: true,
      position: 'bottom',
      thumbWidth: 110
    }
  }"
>
  <pf-slide><img src="/1.jpg"></pf-slide>
  <pf-slide><img src="/2.jpg"></pf-slide>
</pf-pagiflow>

Slider Sync

Link two sliders using CSS selectors.

Synchronized Sliders
<!-- Main -->
<pf-pagiflow id="main-gallery" [options]="{ loop: true }">...</pf-pagiflow>

<!-- Thumbnails -->
<pf-pagiflow [options]="{ sync: '#main-gallery', itemsPerSlide: 4 }">...</pf-pagiflow>

Methods

Access the API using a template reference variable or @ViewChild.

Template Reference
<pf-pagiflow #pf [options]="{ loop: true }">...</pf-pagiflow>

<button (click)="pf.next()">Next</button>
<button (click)="pf.goTo(0)">Reset</button>
.getInstance()
Returns the underlying Pagiflow instance (or null before init / after destroy).
.next()
Go to the next slide.
.prev()
Go to the previous slide.
.goTo(index, options?)
Jump to slide index (0-based). Options: { silent: false, instant: false }.
.play() / .pause()
Start or stop the autoplay timer.
.resume()
Resume from paused state (autoplay/autoScroll).
.togglePlayPause()
Toggle autoplay state.
.setOptions(newOptions, rebuild?)
Update options at runtime. Rebuilds if structural options change.
.reInit(newOptions?)
Completely destroy and re-initialize the slider.

Events

Listen for slide changes and initialization.

slideChange & ready
@endverbatim
<pf-pagiflow 
  (slideChange)="onIndexChange($event)"
  (ready)="onSliderReady($event)"
>
  ...
</pf-pagiflow>
@endverbatim

All Options Reference

Complete list of all configuration options.

Option Type Default Description
direction string 'horizontal' Slide axis: 'horizontal' or 'vertical'.
itemsPerSlide number 1 Visible slides at once.
slidesToScroll number 1 Steps per navigation click.
gap number 8 Pixels between slides.
height string|number auto Viewport height (Required when using vertical, fade, or thumbnails mode.).
startIndex number 0 Initial slide index.
loop boolean false Infinite loop with DOM clones.
speed number 400 Transition duration (ms).
animate boolean true Enable CSS transitions.
fade boolean false Crossfade instead of slide.
nav boolean false Show built-in prev/next buttons.
navDisabledEnd boolean false Disable (not hide) buttons at ends.
navigation object null External buttons { prev, next }.
prevIcon string '‹' Prev button HTML.
nextIcon string '›' Next button HTML.
prevPosition string|obj null Absolute position for prev button.
nextPosition string|obj null Absolute position for next button.
paginate boolean false Show pagination dots.
paginationPosition string|obj null Custom pagination position.
autoplay boolean false Auto-advance slides.
autoplayDelay number 3000 Delay between auto advances (ms).
pauseOnHover boolean true Pause autoplay on hover.
autoScroll boolean false Continuous marquee scrolling.
autoScrollSpeed number 0.5 Pixels per animation frame.
autoScrollDirection string 'left' 'left' or 'right'.
swipeThreshold number 60 Min swipe distance to trigger change.
grid boolean false Enable grid mode per slide.
gridColumns number 2 Grid column count.
gridFill boolean false Fill last page with recycled items.
thumbnails.enabled boolean false Show thumbnail strip.
thumbnails.position string 'bottom' top / bottom / left / right.
thumbnails.thumbWidth number|string 80 Thumbnail width in px.
thumbnails.gap number|string 5 Gap between thumbnails.
thumbnails.sidebarHeight string null Sidebar height for left/right mode.
centerMode boolean false Center active slide with peeking neighbors.
centerPadding number|string 0 Side padding for center mode.
rtl boolean false Right-to-left mode.
keyboard boolean false Arrow key navigation.
lazyLoad boolean false IntersectionObserver image lazy load.
sync string|inst null Selector or instance to sync with.
responsive object {} Breakpoint → options map.
html str|arr null Inject initial slide HTML content during initialization.

See All Docs for the full list of 30+ options.

Frequently Asked Questions

Common questions about using pagiflow/angular.

Run npm i pagiflow, then import the standalone components from pagiflow/angular.
Yes. Both the component and the usePagiflow utility check for the browser platform before initialization.
You can listen to the (ready) event or call pf.getInstance() on the component reference.
If you want a lightweight, zero-dependency slider with straightforward APIs and framework parity, Pagiflow is a strong Angular alternative.
Yes. Use the thumbnails option for thumbnail navigation and sync to connect two slider instances.
Use the responsive option and define breakpoint-based option overrides, such as changing itemsPerSlide and gap.