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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@pmwcs/pagination

v1.1.0

Published

PMWCS pagination component

Downloads

17

Readme

Pagination (PMWCS Addon)

The Pagination component enables the user to select a specific page from a range of pages.

  • Module @pmwcs/pagination
  • Import styles:
    • Using CSS Loader
      • import '@pmwcs/pagination/styles';
    • Or include stylesheets
      • '@pmwcs/icon-button/styles'
      • '@pmwcs/pagination/pagination.css'

Uncontrolled

<Pagination onChange={(evt, page) => {}} />
<Pagination count={3} onChange={(evt, page) => {}} defaultPage={1} />
<Pagination count={5} onChange={(evt, page) => {}} defaultPage={3} showFirstButton showLastButton />

Controlled

function MyPagination ({ count }) {
  const [page, setPage] = useState(1)

  return (
    <Pagination
      page={page}
      count={count}
      onChange={(evt, page) => setPage(page)}
    />
  )
}

Variants

<Pagination primary count={10}  />
<Pagination secondary count={10} />
<Pagination disabled count={10} />
<Pagination rounded count={3} />

Pagination

Enables the user to select a specific page from a range of pages.

Props

| Name | Type | Description | |------|------|-------------| | boundaryCount | number | Number of always visible pages at the beginning and end. Default is 1. | | count | number | The total number of pages. Default is 1. | | defaultPage | number | The page selected by default when the component is uncontrolled. Default is 1. | | page | number | The page selected. (controlled mode) | | disabled | boolean | If true, the pagination component will be disabled. | | hideNextButton | boolean | If true, hide the next-page button. | | hidePrevButton | boolean | If true, hide the previous-page button. | | onChange | (event: Event, page: number) => void | Callback fired when the page is changed. event The event source of the callback. page The page selected. | | showFirstButton | boolean | If true, show the first-page button. | | showLastButton | boolean | If true, show the last-page button. | | siblingCount | number | Number of always visible pages before and after the current page. Default is 1. | | className | string | additional className of ul element | | getItemAriaLabel | (type, page, selected) => string | Custom label generator for aria labels. | | renderItem | (item) => <PaginationItem {...item} /> | Custom render item. Defaults to PaginationItem. | | rounded | boolean | The shape of the pagination items, rounded edges instead of circle. | | size | 'small' \| 'medium' \| 'large' | The size of the pagination component. | primary | boolean | Primary theme. | | secondary | boolean | Secondary theme. |

PaginationItem

Pagination element to select a specific page.

| Name | Type | Description | |------|------|-------------| | className | string | Additional className | | disabled | boolean | Disabled component if true. @default false | | page | number | page number on click | selected | boolean | item is selected | rounded | boolean | item has rounded corners. If false then item is displayed with circle. | size | 'small' \| 'medium' \| 'large' | different sizes of component. @default 'medium' | | type | 'page' \| 'start-ellipsis' \| 'end-ellipsis' \| 'previous' \| 'next' \| 'first' \| 'last' | type of item |