Skip to content

Pagination

Attaches a pagination controls to a container for a list element via usePagination(listEl).

Activate

Pagination is activated by adding the paginate attribute on the list element.

html
<div id="paginationControls"></div>

<ul paginate="paginationControls" page-size="3">
  <li>Apple</li>
  <li>Banana</li>
  <li>Cherry</li>
  <li>Date</li>
  <li>Elderberry</li>
</ul>

Method

usePagination(listEl)

ParameterTypeDescription
listElHTMLElementThe list element whose children will be filtered.

Options

AttributeDefaultDescription
page-size5Defines the total number of pages.
page-current1Defines the current page to display.

Note

For pagination style, use this gist

Released under the MIT License.