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

@surstromming/pagination

v0.1.0

Published

Numbered page navigation.

Readme

@surstromming/pagination

Page navigation: numbered buttons around the current page, ellipses for the folded ranges, previous/next at the ends. Data-driven — pass pageCount, bind v-model, done.

Dependency graph

graph LR
  pagination["@surstromming/pagination"]
  button["@surstromming/button"]
  design["@surstromming/design"]
  icon["@surstromming/icon"]
  pagination --> button
  button --> design
  pagination --> design
  pagination --> icon

Usage

<template>
  <Pagination v-model="page" :page-count="10" />
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { Pagination } from '@surstromming/pagination'

const page = ref(1)
</script>

Props

| Prop | Type | Default | Notes | | ----------- | -------- | ------------ | ---------------------------------- | | v-model | number | — (required) | Current page, 1-based | | pageCount | number | — (required) | Total pages; ≤ 1 renders nothing |

No emits beyond the model update — the consumer reacts to page changing, wherever the change came from.

Windowing

The first and last page are always visible; the current page keeps one neighbor on each side; each folded range is one ellipsis. Up to 7 slots total, so the layout never jumps as the current page moves:

1 2 3 4 5 … 10          // current near the start
1 … 4 [5] 6 … 10        // current in the middle
1 … 6 7 8 9 10          // current near the end

With pageCount ≤ 7 every page is shown, no ellipses.

Anatomy

nav[aria-label=Pagination]
  └─ ul.list                  // flex row, spacing(1) gap
       ├─ li  Button ghost icon   // previous chevron, disabled on page 1
       ├─ li  Button ghost|outline icon  // a page; current is outline + aria-current
       ├─ li  span.ellipsis         // folded range, presentational
       └─ li  Button ghost icon   // next chevron, disabled on the last page

Reuses Button (ghost for pages and chevrons, outline for the current page, all size="icon") — pagination is exactly the styling Button already has, unlike the sidebar rows that needed their own paint.

Tokens

Everything comes from Button; the component adds only spacing(1) gaps and the ellipsis box. Nothing hardcoded.

Accessibility

  • <nav aria-label="Pagination"> around a real list.
  • The current page is aria-current="page" — the outline variant is the visual, the attribute is the semantics.
  • Chevron buttons are icon-only with aria-label="Previous page" / "Next page"; at the ends they render disabled.
  • Ellipses are aria-hidden — they're a visual gap, not a control.

Recipes

<!-- Derive pageCount from data -->
<Pagination v-model="page" :page-count="Math.ceil(total / pageSize)" />

<!-- Server-side: refetch on change -->
<Pagination v-model="page" :page-count="pageCount" />
watch(page, (p) => fetchRows(p))

Notes

  • Buttons only, no href mode in v1 — the SPA case is the model; a link mode (real URLs, middle-click) follows the SidebarGroup precedent if needed later.
  • No siblingCount prop — one neighbor each side is the fixed policy until a real consumer needs more.
  • The component clamps nothing: it disables what can't be clicked, and trusts page to be within range — the consumer owns the state.