npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@justeattakeaway/pie-pagination

v0.2.1

Published

PIE design system pagination built using web components

Readme

@justeattakeaway/pie-pagination

Source Code | Design Documentation | NPM

@justeattakeaway/pie-pagination is a Web Component built using the Lit library. It offers a simple and accessible pagination component for web applications.

Table of Contents

Installation

To install any of our web components in your application, we would suggest following the getting started guide to set up your project.

Ideally, you should install the component using the @justeattakeaway/pie-webc package, which includes all of the components. Or you can install the individual component package.

Documentation

Properties

| Prop | Options | Description | Default | |---------------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------| | currentPage | number| The currently active page (1-based). This component is fully controlled, so it never updates this value itself; the consumer is responsible for updating it in response to the pie-pagination-page-change event. | 1 | | totalPages | number| The total number of pages to render. | 1 | | disabled | boolean| When true, all pagination controls are disabled. | false | | aria | object| The ARIA attributes for the pagination landmark. Offers a label used for the aria-label of the wrapping <nav> element. | undefined |

Slots

This component does not use any slots.

CSS Variables

This component does not expose any CSS variables.

Events

| Event | Type | Description | |-------------------------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | pie-pagination-page-change | CustomEvent | Fired when the user interacts with any pagination control. The event detail contains { currentPage }, the page the user wants to navigate to. | | pie-pagination-prev | CustomEvent | Fired when the user clicks the "previous" control. The event detail contains { currentPage }. This event fires in addition to pie-pagination-page-change. | | pie-pagination-next | CustomEvent | Fired when the user clicks the "next" control. The event detail contains { currentPage }. This event fires in addition to pie-pagination-page-change. |

Page range and ellipsis

When totalPages is large, the component automatically collapses the pages outside the current page's window behind a non-interactive ellipsis (…) separator. The first and last page are always visible. When the current page is near an edge, the window grows to five page buttons anchored to that edge; in the middle of the range only the current page and its immediate neighbours are shown. Seven pages is the widest layout the component ever renders, so ellipses only appear beyond that:

| Scenario | Rendered items | |-------------------------------|---------------------| | Up to 7 pages | 1 2 3 4 5 6 7 | | Near the start (page 2 of 50) | 1 2 3 4 5 … 50 | | Middle (page 25 of 50) | 1 … 24 25 26 … 50 | | Near the end (page 49 of 50) | 1 … 46 47 48 49 50|

The visible range is derived entirely from the currentPage and totalPages props — the number of visible page controls is not configurable. The ellipsis separator is non-interactive and hidden from assistive technologies.

Usage Examples

For HTML:

// import as module into a js file e.g. main.js
import '@justeattakeaway/pie-webc/components/pagination.js'
<!-- pass js file into <script> tag -->

<script type="module" src="/main.js"></script>
<pie-pagination currentPage="2" totalPages="10"></pie-pagination>

<script>
  const pagination = document.querySelector('pie-pagination');

  pagination.addEventListener('pie-pagination-page-change', (event) => {
    // The component is controlled — update the prop yourself
    pagination.currentPage = event.detail.currentPage;
  });
</script>

The pie-pagination-prev and pie-pagination-next events let you hook into the previous/next controls specifically. They fire in addition to pie-pagination-page-change, so you can use either one:

<pie-pagination currentPage="2" totalPages="10"></pie-pagination>

<script>
  const pagination = document.querySelector('pie-pagination');

  pagination.addEventListener('pie-pagination-prev', (event) => {
    console.log('previous clicked, requested page:', event.detail.currentPage);
    pagination.currentPage = event.detail.currentPage;
  });

  pagination.addEventListener('pie-pagination-next', (event) => {
    console.log('next clicked, requested page:', event.detail.currentPage);
    pagination.currentPage = event.detail.currentPage;
  });
</script>

For Native JS Applications, Vue, Angular, Svelte etc.:

// Vue templates (using Nuxt 3)
import '@justeattakeaway/pie-webc/components/pagination.js'

For React Applications:

import { PiePagination } from '@justeattakeaway/pie-webc/react/pagination.js';

<PiePagination
  currentPage={currentPage}
  totalPages={totalPages}
  onPiePaginationPageChange={(event) => setCurrentPage(event.detail.currentPage)}
/>

The pie-pagination-prev and pie-pagination-next events are exposed as onPiePaginationPrev and onPiePaginationNext:

<PiePagination
  currentPage={currentPage}
  totalPages={totalPages}
  onPiePaginationPrev={(event) => setCurrentPage(event.detail.currentPage)}
  onPiePaginationNext={(event) => setCurrentPage(event.detail.currentPage)}
/>

Questions and Support

If you work at Just Eat Takeaway.com, please contact us on #help-designsystem. Otherwise, please raise an issue on Github.

Contributing

Check out our contributing guide for more information on local development and how to run specific component tests.