pagination

Five pagination modes: dots, fraction, progress bar, dynamic bullets, and fully custom HTML.

Import

import { pagination } from '@andresclua/sliderkit-plugins'

Usage

new Slider('#el', {
  plugins: [
    pagination({
      type: 'dots',
      clickable: true,
    }),
  ],
})

Options

OptionTypeDefaultDescription
type'dots' | 'fraction' | 'progress' | 'dynamic' | 'custom''dots'Pagination style.
elstring | HTMLElementTarget element. Auto-created inside container if omitted.
clickablebooleantrueAllow clicking dots to navigate (dots/dynamic only).
dynamicBulletsbooleanfalseScale nearby bullets smaller (dynamic mode).
renderCustom({ current, total }) => stringCustom HTML renderer (custom mode).

Types

// Dots
pagination({ type: 'dots', clickable: true })

// Fraction "2 / 5"
pagination({ type: 'fraction' })

// Horizontal fill bar
pagination({ type: 'progress' })

// Shrinking dots around active
pagination({ type: 'dynamic', dynamicBullets: true })

// Custom HTML
pagination({
  type: 'custom',
  renderCustom: ({ current, total }) =>
    `<strong>${current}</strong> of ${total}`,
})

Demos