Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

The pager

Give the pager the current page and the total, and it changes page when you pick a number.

A standalone pager
Numbered page buttons driven by the current page and the total.
Show code
<app-table-pagination page="1" page-size="10" total="42" href-template="/projects?page={page}&pageSize={pageSize}" />

Under a table

Place the pager under a table and show only the current page's rows above it.

A paged table
Only the current page's rows show above the pager, and changing the page reslices them.
BuildingStatus
Building 1Draft
Building 2Compliant
Building 3Compliant
Building 4Draft
Building 5Compliant
Show code
<app-data-table>
    <thead><tr><th>Building</th><th>Status</th></tr></thead>
    <tbody>… current page's rows …</tbody>
</app-data-table>
<app-table-pagination page="1" page-size="5" total="42" href-template="/projects?page={page}&pageSize={pageSize}" />

Standalone for cards and lists

Use the standalone pager under a card or list, where no table footer rule is needed.

A standalone numbered pager
Previous and next flank a windowed set of page buttons, with the current page marked.
Show code
<app-table-pagination page="6" total-pages="20" variant="Standalone" href-template="?page={page}" />

Numbered and prev-next

Use arrows for a long set that people step through one page at a time, and numbered pages for a short set.

A prev-next pager
Arrows with no page buttons, and a readout that says where the person is.
Show code
<app-table-pagination page="2" page-size="10" total="42" mode="PrevNext" href-template="/projects?page={page}&pageSize={pageSize}" />

Sizes

Use a small size for a compact layout in sidebars, card headers, or dense toolbars.

Compact pagination
The 'sm' size reduces padding and font sizes for tighter layouts.
Show code
<app-table-pagination page="1" total-pages="8" size="Sm" href-template="?page={page}" />

Every option

Every value of every prop, one cell each.

page

page="1" (first page, previous disabled)
page="5" (last page, next disabled)

total

total="42" (5 pages of 10)

totalPages

total-pages="3" (wins over total="42")
total-pages="1" (renders nothing)

pageSize

page-size="10" (page-size menu shows)
page-size="25"

onPageChange

onPageChange (React only): page buttons follow href-template

onPageSizeChange

onPageSizeChange (React only): the size menu follows href-template with {pageSize}

href-template

href-template="?page={page}": the link each page button follows

pageSizes

page-sizes="20,40"
page-sizes left out: 5, 10, 25 and 50 (default)

mode

mode="numbered" (default)
mode="prev-next"

showPageSize

show-page-size="true" (default)
show-page-size="false"

summary

summary="false" (default)
summary: Showing 11 to 20 of 42

siblings

siblings="0"
siblings="1"
siblings="2" (default)
siblings="3"

size

size="md" (default)
size="sm"

variant

variant="footer" (default)
variant="standalone"

ariaLabel

aria-label="Results pages": names the nav for screen readers, not drawn

rowsPerPageLabel

rows-per-page-label="Items per screen": names the page-size menu for screen readers

pageSizeLabel

page-size-label="{count} rows": each menu option reads 10 rows

previousLabel

previous-label="Back": the previous arrow's accessible name

nextLabel

next-label="Forward": the next arrow's accessible name

pageLabel

page-label="Go to {page}": each page button's accessible name

rangeText

range-text="{page} of {pages}": the readout in prev-next mode

className

class="analytics-pager": an extra class on the nav

Guidance

What to do, and what to avoid.

Use it when

  • A list is long enough that showing everything at once is unwieldy.
  • The user needs to control how many rows they see at a time.
  • You are paging content that is not an AppDataTable and need the footer standalone.

Reach for something else when

  • The list is short and fits comfortably on one screen. → no pager
  • You are already using AppDataTable. → the pagination prop on AppDataTable
  • The user should keep scrolling instead of paging. → infinite scroll

Show the page and the total

Do

The page buttons show the current page and how many there are, so the user always knows where they are in the list.

Avoid

Bare prev/next buttons with no page readout hide how big the list is or where the user stands.

Sit the pager under its table

Do
BuildingStatus
Building 1Draft
Building 2Compliant
Building 3Compliant
Building 4Draft
Building 5Compliant

The pager sits flush under the table it controls, so the two read as one visual unit.

Avoid
BuildingStatus
Building 1Draft
Building 2Compliant
Building 3Compliant

A pager floating above its table breaks the expected footer placement and reads as disconnected.

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

numbered prev-next
true false
true false
md sm
footer standalone
React, generated from the controls
const [page, setPage] = useState(3);
const [pageSize, setPageSize] = useState(10);
const totalPages = Math.ceil(42 / pageSize);

<AppTablePagination
  page={page}
  totalPages={totalPages}
  pageSize={pageSize}
  pageSizes={pageSizes}
  onPageChange={setPage}
  onPageSizeChange={(size) => { setPageSize(size); setPage(1); }}
/>
Razor, the same props
<app-table-pagination page="3" page-size="10" total="42" href-template="?total=42&total-pages=&mode=numbered&page-sizes=5%2C10%2C25%2C50&show-page-size=true&summary=false&siblings=2&size=md&variant=footer&aria-label=Pagination&page={page}&page-size={pageSize}" />

19 props. The 5 most used come first.

Used on most screens 5 props

PropTypeDefaultDescription
pagedefault 1 int 1 The current page, counted from 1.
totaldefault - int - The number of rows across all pages. Used when total-pages is not given: the page count is the total divided by page-size, rounded up.
page-sizedefault - int - The rows per page. The page-size menu shows it as selected; without it, or with show-page-size set to false, no menu shows.
total-pagesdefault - int - The number of pages. It wins over total when both are given.
page-sizesdefault 5,10,25,50 string 5,10,25,50 Comma-separated options for the page-size menu, each shown as "N per page". The current page size is always offered.

Less common 14 props

PropTypeDefaultDescription
href-templatedefault required string required The link address. {page} is required; {pageSize} is required when the menu shows.
show-page-sizedefault true bool true Shows the page-size menu. Set it to false for a pager that pages but does not expose the page size.
summarydefault false bool false Shows Showing x to y of z at the start of the pager. It needs total and page-size; without both nothing is shown.
modedefault numbered numbered | prev-next numbered numbered shows windowed page buttons (first, last and an ellipsis over any run of hidden pages) between the arrows. prev-next shows the arrows with a Page N of M readout.
siblingsdefault 2 int 2 The pages shown either side of the current page in numbered mode.
sizedefault md sm | md md sm draws 28px page and arrow buttons with 12px text.
variantdefault footer footer | standalone footer footer sits under a table, right aligned, with a top rule. standalone is centred with no rule, for cards and lists.
aria-labeldefault Pagination string Pagination The accessible name of the pager.
rows-per-page-labeldefault Rows per page string Rows per page Replaces the built-in English text, for other languages.
page-size-labeldefault {count} per page string {count} per page Replaces the built-in English text, for other languages. The token {count} is the page size.
range-textdefault Page {page} of {pages} string Page {page} of {pages} Replaces the built-in English text, for other languages. The tokens {page} and {pages} are the current page and the page count.
page-labeldefault Page {page} string Page {page} Replaces the built-in English text, for other languages. The token {page} is the page number.
previous-labeldefault Previous page string Previous page Replaces the built-in English text, for other languages.
next-labeldefault Next page string Next page Replaces the built-in English text, for other languages.

Screen reader

4 notes
  • The previous and next arrows are native buttons named Previous page and Next page, disabled on the first and last page.
  • Each page button is named Page N, and the current one carries aria-current="page".
  • The ellipsis between page buttons is hidden from assistive technology.
  • The page-size menu is named Rows per page.

Do and avoid

2 pairs

Show the page and the total

Do

The page buttons show the current page and how many there are, so the user always knows where they are in the list.

Avoid

Bare prev/next buttons with no page readout hide how big the list is or where the user stands.

Sit the pager under its table

Do
BuildingStatus
Building 1Draft
Building 2Compliant
Building 3Compliant
Building 4Draft
Building 5Compliant

The pager sits flush under the table it controls, so the two read as one visual unit.

Avoid
BuildingStatus
Building 1Draft
Building 2Compliant
Building 3Compliant

A pager floating above its table breaks the expected footer placement and reads as disconnected.