Pagination

A pagination with page navigation, next and previous links.

Installation

Install the component package, shared coss-svelte theme, and Bits UI peer.

npm install coss-svelte @coss-svelte/theme bits-ui

Usage

Import the Svelte component exports directly from the package.

import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationNextButton, PaginationPage, PaginationPrevious, PaginationPrevButton } from "coss-svelte";

Anatomy

  • Pagination
  • PaginationContent
  • PaginationEllipsis
  • PaginationItem
  • PaginationLink
  • PaginationNext
  • PaginationNextButton
  • PaginationPage
  • PaginationPrevious
  • PaginationPrevButton

API Reference

Pagination

A pagination with page navigation, next and previous links.

PropTypeDefaultDescription
bind:pagenumber2Current page. Bind with `bind:page`.
pagesnumber5Total number of pages to render when count is not provided.
countnumbertotalPagesTotal item count used to calculate pagination.
perPagenumber-Items per page used with count to calculate page totals.
children : Snippet<[PaginationSnippetProps]>bind:ref : HTMLElement | null

Inherits from Bits UI Pagination.Root.

PaginationContent

Wraps the primary content for the parent component.

children : Snippet<[]>

Inherits from Svelte <ul> attributes.

PaginationEllipsis

Represents skipped pages in pagination.

children : Snippet<[]>

Inherits from Svelte <span> attributes.

PaginationItem

Renders one selectable or repeated item.

children : Snippet<[]>

Inherits from Svelte <li> attributes.

PaginationNext

Renders navigation to the next page.

PropTypeDefaultDescription
hrefstring""Renders the component as a link target when provided.
children : Snippet<[]>

Inherits from Svelte <span> attributes.

PaginationNextButton

Renders a button-shaped control for the parent component.

children : Snippet<[]>child : Snippet<[{ props: Record<string, unknown> }]>bind:ref : HTMLElement | null

Inherits from Bits UI Pagination.NextButton.

PaginationPage

Renders one numbered page control.

children : Snippet<[]>child : Snippet<[{ props: Record<string, unknown> }]>bind:ref : HTMLElement | null

Inherits from Bits UI Pagination.Page.

PaginationPrevious

Renders navigation to the previous page.

PropTypeDefaultDescription
hrefstring""Renders the component as a link target when provided.
children : Snippet<[]>

Inherits from Svelte <span> attributes.

PaginationPrevButton

Renders a button-shaped control for the parent component.

children : Snippet<[]>child : Snippet<[{ props: Record<string, unknown> }]>bind:ref : HTMLElement | null

Inherits from Bits UI Pagination.PrevButton.

Implementation Details

Status
Stable
Foundation
bits
Category
Layout & Navigation
Particles
3