@aboutbits/pagination

Pagination
6,346
Install
npm install @aboutbits/pagination
Latest Version:2.0.2
License:MIT
Last Updated:Oct 6, 2026
Links: GitHub  ·  npm
Maintainer: mollpo97

Pagination

npm package license

This pagacke includes a pagination calculation, where you can simply pass some basic information to the calcualtion function, and in return you receive an object with all relevant pagination information.

Table of content

Usage

First, you have to install the package:

npm install @aboutbits/pagination

Second, you can call the calculate function by passing the following information:

  • page: The current page
  • size: The amount of items shown per page
  • total: The amount of total items in the list/collection
  • config: A configuration object containing the following possible configuration values:
    • indexType: The starting point of the pagination (default: IndexType.ONE_BASED)
    • maxPages: The maximum amount of pages that should be shown (default: 5)

In return, you receive an object with all relevant information:

import { calculatePagination } from '@aboutbits/pagination'

let pagination = calculatePagination(1, 5, 100)

console.log(pagination)

This would return the following object:

{
  "previous": {
    "indexNumber": 1,
    "isDisabled": true
  },
  "next": {
    "indexNumber": 2,
    "isDisabled": false
  },
  "pages": [
    {
      "indexNumber": 1,
      "displayNumber": 1,
      "isCurrent": true
    },
    {
      "indexNumber": 2,
      "displayNumber": 2,
      "isCurrent": false
    },
    {
      "indexNumber": 3,
      "displayNumber": 3,
      "isCurrent": false
    },
    {
      "indexNumber": 4,
      "displayNumber": 4,
      "isCurrent": false
    },
    {
      "indexNumber": 5,
      "displayNumber": 5,
      "isCurrent": false
    }
  ]
}

Build & Publish

To build and publish the package, simply commit all changes and push them to master. Then run one of the following commands locally:

npm version patch
npm version minor
npm version major

Information

About Bits is a company based in South Tyrol, Italy. You can find more information about us on our website.

Support

For support, please contact info@aboutbits.it.

Credits

License

The MIT License (MIT). Please see the license file for more information.

Related Packages

remote-editable-pager

框架无关的可编辑远程分页器:分页加载 + 跨页编辑 + 增删行 + 保存时自动汇总全量数...

395
vuejs-paginate

A simple pagination component for Vue.js

1,264,788 765
vue-pagination-2

Vue.js 2 pagination component

1,088,836 186
v-pagination-3

Vue.js 3 pagination component

823,217 186
vuejs-paginate-next

A simple Vue3 pagination component.

795,954 43

Version History

Version Released License
2.0.2 MIT
2.0.1 MIT
2.0.0 MIT
1.1.0 MIT
1.0.0 MIT