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

@htmlbricks/hb-paginate

v0.71.10

Published

Pagination bar with first/prev/next/last and nearby page buttons, optional “showing X–Y of total” text, configurable page-size input or select, and optional sort field and direction controls with i18n labels.

Readme

hb-paginate

Category: utilities · Tags: utilities, navigation

Description

Pagination controls (first / previous / numbered pages / next / last), optional “showing X–Y of total” text, optional page-size via hb-input-number or hb-input-select, and optional sort field + direction with i18n. Dispatches pageChange, changePageSize, and changeSort.

Styling (Bulma)

The component bundles Bulma 1.x in the shadow root: form/shared, form/select (sort dropdown), and form/pagination, with theme defaults on :host (--bulma-hb-def-*). Set public --bulma-* on body or :root so they inherit onto the host and match the rest of the app. Relevant tokens include pagination, controls, text, and borders — see Bulma CSS variables.

Shadow markup (simplified):

  • div.hb-paginate — single horizontal row: optional info/size block + nav.pagination.
  • div.paginate-bar — rendered only when range text and/or page-size UI is needed (avoids extra flex gap when only pagination is shown).
  • ul.pagination-list / button.pagination-link — Bulma pagination; list uses gap instead of doubled per-link horizontal margins.
  • Sort UI: div.select.is-small + native select, and a direction button.pagination-link.

Host-level overrides (optional):

| Variable | Purpose | |----------|---------| | --hb-paginate-height | Fixed host height (default: --bulma-control-height, fallback 2.5rem). | | --hb-paginate-bar-padding-inline-start | Left inset for the info/size bar (default: --bulma-pagination-item-padding-left, fallback 0.5em). | | --hb-paginate-list-gap | Horizontal gap between pagination list items (default: half of --bulma-pagination-item-margin). |

Custom element

hb-paginate

Attributes (snake_case; string values in HTML)

  • id, style (optional): strings.
  • page, pages (required): current page index and total pages, as strings.
  • info (optional): JSON string — total, size, page_size_type ("number" | "select"), page_size_options, sort_fields, sort_by, sort_direction, sort_disabled, sort_direction_disabled, sort_strict_direction, sort_default_value, sort_default_label.
  • i18nlang (optional): e.g. en, it.

Events

  • pageChange: { page: number; pages: number }
  • changePageSize: { page_size: number }
  • changeSort: { sort_by: string; sort_direction: string }

Usage notes

  • i18n: Italian and English in metadata; set i18nlang accordingly.
  • hb-table: while the table is in is_loading, hb-paginate remains mounted but hidden; an inline Bulma skeleton overlay mimics the bar. Use hb-paginate directly when you embed it outside the table.
  • Combined examples (sort + page size): see extra/docs.ts.

Types

export type Component = {
  id?: string;
  style?: string;
  pages: number;
  page: number;
  info?: {
    total?: number;
    size?: number;
    page_size_type?: "number" | "select";
    page_size_options?: string;
    sort_fields?: { value: string; label?: string }[];
    sort_by?: string;
    sort_direction?: "asc" | "desc" | "default";
    sort_disabled?: boolean;
    sort_direction_disabled?: boolean;
    sort_strict_direction?: boolean;
    sort_default_value?: string;
    sort_default_label?: string;
  };
  i18nlang?: string;
};

export type Events = {
  pageChange: { page: number; pages: number };
  changePageSize: { page_size: number };
  changeSort: { sort_by: string; sort_direction: string };
};

Minimal HTML example

<hb-paginate page="0" pages="5" i18nlang="en"></hb-paginate>