Back to Tuist

PaginationGroup

noora/docs/components/paginationgroup.md

4.204.02.3 KB
Original Source
<!-- Generated by scripts/generate-web-components.js. Do not edit directly. -->

PaginationGroup

Navigates a finite collection of numbered pages.

html
<noora-pagination-group current-page="2" number-of-pages="10"></noora-pagination-group>

Attributes

AttributeType or allowed valuesDefaultDescription
current-pagenumber1Sets the selected page.
number-of-pagesnumber1Sets the total page count.
href-templatestringNoneSets link locations by replacing {page} with the page number.

Events

EventTypeDescription
noora-page-changeCustomEvent<{ page: number }>Emitted when a page control is activated.

Styling parts

PartDescription
paginationThe pagination container.
pageEach page control.
previousThe previous-page control.
nextThe next-page control.

Page activation emits a noora-page-change event.

Page positions

Compare the first, middle, last, and second page positions.

html
<noora-pagination-group current-page="1" number-of-pages="12"></noora-pagination-group>
<noora-pagination-group current-page="6" number-of-pages="12"></noora-pagination-group>
<noora-pagination-group current-page="12" number-of-pages="12"></noora-pagination-group>
<noora-pagination-group current-page="2" number-of-pages="12"></noora-pagination-group>

Page counts

Show ellipsis behavior across small and large collections.

html
<noora-pagination-group current-page="3" number-of-pages="5"></noora-pagination-group>
<noora-pagination-group current-page="25" number-of-pages="50"></noora-pagination-group>
<noora-pagination-group current-page="500" number-of-pages="999"></noora-pagination-group>

Edge cases

Handle one-page, two-page, and near-boundary collections.

html
<noora-pagination-group current-page="1" number-of-pages="1"></noora-pagination-group>
<noora-pagination-group current-page="1" number-of-pages="2"></noora-pagination-group>
<noora-pagination-group current-page="2" number-of-pages="2"></noora-pagination-group>
<noora-pagination-group current-page="3" number-of-pages="20"></noora-pagination-group>
<noora-pagination-group current-page="18" number-of-pages="20"></noora-pagination-group>