Link-based page navigation with Previous and Next links and an ellipsis for skipped pages.
<x-markas.pagination :page="1" :total="10" href="?page={page}" /><x-markas.pagination :page="5" :total="10" href="?page={page}" /><x-markas.pagination :page="10" :total="10" href="?page={page}" />import { Pagination } from "@/components/markas/Pagination";
<Pagination page={1} total={10} href="?page={page}" />import { Pagination } from "@/components/markas/Pagination";
<Pagination page={5} total={10} href="?page={page}" />import { Pagination } from "@/components/markas/Pagination";
<Pagination page={10} total={10} href="?page={page}" />import Pagination from "@/components/markas/Pagination.vue";
<Pagination :page="1" :total="10" href="?page={page}" />import Pagination from "@/components/markas/Pagination.vue";
<Pagination :page="5" :total="10" href="?page={page}" />import Pagination from "@/components/markas/Pagination.vue";
<Pagination :page="10" :total="10" href="?page={page}" /><script lang="ts">
import Pagination from "$lib/components/markas/Pagination.svelte";
</script>
<Pagination page={5} total={10} href={"?p={page}"} />---
import Pagination from "@/components/markas/Pagination.astro";
---
<Pagination page={5} total={10} href="?p={page}" />import { Component } from "@angular/core";
import { Pagination } from "./markas/pagination.component";
@Component({
selector: "markas-example",
imports: [Pagination],
template: `<nav markas-pagination page="5" total="10" [href]="href"></nav>`,
})
export default class PaginationExample {
protected readonly href = "?p={page}";
}Examples
First page
<x-markas.pagination :page="1" :total="10" href="?p={page}" />import { Pagination } from "@/components/markas/Pagination";
export default function Example() {
return <Pagination page={1} total={10} href="?p={page}" />;
}<script setup lang="ts">
import Pagination from "@/components/markas/Pagination.vue";
</script>
<template>
<Pagination :page="1" :total="10" href="?p={page}" />
</template><script lang="ts">
import Pagination from "$lib/components/markas/Pagination.svelte";
</script>
<Pagination page={1} total={10} href={"?p={page}"} />---
import Pagination from "@/components/markas/Pagination.astro";
---
<Pagination page={1} total={10} href="?p={page}" />import { Component } from "@angular/core";
import { Pagination } from "./markas/pagination.component";
@Component({
selector: "markas-example",
imports: [Pagination],
template: `<nav markas-pagination page="1" total="10" [href]="href"></nav>`,
})
export default class PaginationStartExample {
protected readonly href = "?p={page}";
}Last page
<x-markas.pagination :page="10" :total="10" href="?p={page}" />import { Pagination } from "@/components/markas/Pagination";
export default function Example() {
return <Pagination page={10} total={10} href="?p={page}" />;
}<script setup lang="ts">
import Pagination from "@/components/markas/Pagination.vue";
</script>
<template>
<Pagination :page="10" :total="10" href="?p={page}" />
</template><script lang="ts">
import Pagination from "$lib/components/markas/Pagination.svelte";
</script>
<Pagination page={10} total={10} href={"?p={page}"} />---
import Pagination from "@/components/markas/Pagination.astro";
---
<Pagination page={10} total={10} href="?p={page}" />import { Component } from "@angular/core";
import { Pagination } from "./markas/pagination.component";
@Component({
selector: "markas-example",
imports: [Pagination],
template: `<nav markas-pagination page="10" total="10" [href]="href"></nav>`,
})
export default class PaginationEndExample {
protected readonly href = "?p={page}";
}Few pages
<x-markas.pagination :page="2" :total="4" href="?p={page}" />import { Pagination } from "@/components/markas/Pagination";
export default function Example() {
return <Pagination page={2} total={4} href="?p={page}" />;
}<script setup lang="ts">
import Pagination from "@/components/markas/Pagination.vue";
</script>
<template>
<Pagination :page="2" :total="4" href="?p={page}" />
</template><script lang="ts">
import Pagination from "$lib/components/markas/Pagination.svelte";
</script>
<Pagination page={2} total={4} href={"?p={page}"} />---
import Pagination from "@/components/markas/Pagination.astro";
---
<Pagination page={2} total={4} href="?p={page}" />import { Component } from "@angular/core";
import { Pagination } from "./markas/pagination.component";
@Component({
selector: "markas-example",
imports: [Pagination],
template: `<nav markas-pagination page="2" total="4" [href]="href"></nav>`,
})
export default class PaginationFewPagesExample {
protected readonly href = "?p={page}";
}Table footer
Showing 21 to 30 of 97 results
Showing 21 to 30 of 97 results
Showing 21 to 30 of 97 results
Showing 21 to 30 of 97 results
Showing 21 to 30 of 97 results
<div class="grid gap-3 border-t border-line pt-3">
<p class="text-sm text-muted">Showing 21 to 30 of 97 results</p>
<x-markas.pagination :page="3" :total="10" href="?p={page}" />
</div>import { Pagination } from "@/components/markas/Pagination";
export default function Example() {
return (
<div className="grid gap-3 border-t border-line pt-3">
<p className="text-sm text-muted">Showing 21 to 30 of 97 results</p>
<Pagination page={3} total={10} href="?p={page}" />
</div>
);
}<script setup lang="ts">
import Pagination from "@/components/markas/Pagination.vue";
</script>
<template>
<div class="grid gap-3 border-t border-line pt-3">
<p class="text-sm text-muted">Showing 21 to 30 of 97 results</p>
<Pagination :page="3" :total="10" href="?p={page}" />
</div>
</template><script lang="ts">
import Pagination from "$lib/components/markas/Pagination.svelte";
</script>
<div class="grid gap-3 border-t border-line pt-3">
<p class="text-sm text-muted">Showing 21 to 30 of 97 results</p>
<Pagination page={3} total={10} href={"?p={page}"} />
</div>---
import Pagination from "@/components/markas/Pagination.astro";
---
<div class="grid gap-3 border-t border-line pt-3">
<p class="text-sm text-muted">Showing 21 to 30 of 97 results</p>
<Pagination page={3} total={10} href="?p={page}" />
</div>Installation
npx markasui@latest add paginationpnpm dlx markasui@latest add paginationyarn dlx markasui@latest add paginationbunx --bun markasui@latest add pagination- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
resources/views/components/markas/pagination.blade.php.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/Pagination.tsx.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/Pagination.vue.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/lib/components/markas/Pagination.svelte.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/Pagination.astro.
- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/app/markas/pagination.component.ts.
Usage
<x-markas.pagination :page="$users->currentPage()" :total="$users->lastPage()" href="?page={page}" />No Alpine.js needed.
import { Pagination } from "@/components/markas/Pagination";
<Pagination page={5} total={10} href="?page={page}" />;<template>
<Pagination :page="5" :total="10" href="?page={page}" />
</template><script lang="ts">
import Pagination from "$lib/components/markas/Pagination.svelte";
</script>
<Pagination page={5} total={10} href={"?page={page}"} />Wrap the pattern in {"..."}, because {page} inside a quoted Svelte attribute is an expression.
---
import Pagination from "@/components/markas/Pagination.astro";
---
<Pagination page={5} total={10} href="?page={page}" />No client script: the links are plain anchors.
import { Component } from "@angular/core";
import { Pagination } from "./markas/pagination.component";
@Component({
selector: "app-results",
imports: [Pagination],
template: `<nav
markas-pagination
[page]="page"
total="10"
[href]="href"
></nav>`,
})
export class Results {
readonly page = 5;
readonly href = "?page={page}";
}Angular uses an attribute selector on the native nav, so id, class, and other attributes stay on the nav. Bind href from a property, because {page} clashes with template syntax.
- The number of page buttons stays at
siblings * 2 + 5(7 by default), for example page 5 of 10: 1 … 4 5 6 … 10. pageRange(page, total, siblings)is exported from the React, Vue, Svelte (module script), and Angular versions if you want to build your own layout.- The nav is labelled “Pagination” and the links read “Previous” and “Next”. Translate them with
navLabel,previousLabel, andnextLabel(Blade:nav-label,previous-label,next-label).
Props
| Name | Type | Default | Description |
|---|---|---|---|
page | number | 1 | Current page. Clamped to the range 1 to total. |
total | number | 1 | Number of pages. |
href | string | '?page={page}' | URL pattern. {page} is replaced with the page number. |
siblings | number | 1 | Number of pages shown on each side of the current page. |
navLabel | string | Pagination | Accessible label of the nav element. |
previousLabel | string | Previous | Text of the previous page link. |
nextLabel | string | Next | Text of the next page link. |
Accessibility
- Wrapped in a nav labelled by navLabel.
- The active page has aria-current=page.
- Previous and Next use rel prev and next, and become an aria-disabled span on the first or last page.
- The ellipsis is aria-hidden.
- In a narrow container the Previous and Next text is only visually hidden (sr-only), so the accessible name stays.
Related components
More navigation components with the same classes in every framework.
- AccordionCollapsible sections built on native details and summary, no JavaScript needed.
- BreadcrumbTrail of the current page's location in the site hierarchy, with the current page marked by aria-current.
- CollapsibleA single section that opens and closes, built on native details and summary without JavaScript. Good for show more content.
- FooterSite footer with six layouts: link columns, centered glow, newsletter pill card, giant cropped wordmark, dark glowing call to action, and a floating pill.
- MenubarHorizontal bar of menus like a desktop app, built on the Popover API, with keyboard support following the WAI-ARIA Menubar pattern.
- NavbarSite header with a brand, links, dropdown menus, a sliding hover pill, an actions area, and a mobile menu with collapsible groups.