Skip to content

Pagination

Project a large result set into direct pages and boundary controls.

Usage

Compact

Use a reduced control set when horizontal space is limited.

Use a reduced control set when horizontal space is limited.

Page size

Change the number of items per page and return to the first valid page when necessary.

Change the number of items per page and return to the first valid page when necessary.

Pages only

Render direct page choices without first and last controls.

Render direct page choices without first and last controls.

Controlled

Let the parent own the current value and apply accepted changes back to the component.

Let the parent own the current value and apply accepted changes back to the component.

Examples

Long range

Navigate a large result set without rendering every page number.

Navigate a large result set without rendering every page number.

API

Vue package: @sectile/vue/pagination

Components
  • PaginationRoot
  • PaginationItem
  • PaginationFirst
  • PaginationPrevious
  • PaginationNext
  • PaginationLast

Props

PaginationRootProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

defaultItemsPerPage

Initial uncontrolled number of records shown per page.

defaultValue

Initial value used when the component owns its state.

disabled

Whether interaction is unavailable.

getControlLabel

Returns the accessible label announced for a pagination control.

getPageLabel

Returns the accessible label announced for a page choice.

itemsPerPage

Controlled number of records shown per page.

label

Accessible name announced for the control.

modelValue

Current value when state is controlled by the parent.

readonly

Whether the value can be inspected but not changed.

showControls

Whether first, previous, next, and last controls are included.

showEdges

Whether the first and last page numbers remain visible.

siblingCount

Number of adjacent page choices shown around the current page.

total

Total number of records represented by pagination.

PaginationItemProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

item

Pagination item rendered by this part.

Slots

PaginationRootSlotProps

items

Current derived item collection.

itemsPerPage

Number of records currently shown per page.

page

Current one-based page number.

pageCount

Total number of available pages.

range

Current start and end values.

PaginationItemSlotProps

disabled

Whether interaction is unavailable.

item

Current pagination item.

selected

Whether this item is selected.

Events

PaginationRoot

update:itemsPerPage

Emitted when the requested page size changes.

update:modelValue

Emitted when the component requests a new controlled value.

Other types

PaginationPageLabelResolver

ts
type PaginationPageLabelResolver = NonNullable<PaginationRootProps['getPageLabel']>

PaginationControlLabelResolver

ts
type PaginationControlLabelResolver = NonNullable<PaginationRootProps['getControlLabel']>

PaginationValueChangeHandler

ts
type PaginationValueChangeHandler = (value: number) => void

PaginationItemsPerPageChangeHandler

ts
type PaginationItemsPerPageChangeHandler = (value: number) => void

Parts

Shared scope: [data-scope="pagination"]. Combine it with a part selector to keep styles local to this component.

PartSelectorRoleExtra attributes
root[data-part="root"]Defines the component boundary and owns its composed parts.
first[data-part="first"]Moves to the first page.
previous[data-part="previous"]Moves to the previous item or page.
item[data-part="item"]Represents one selectable or actionable item.
next[data-part="next"]Moves to the next item or page.
last[data-part="last"]Moves to the last page.

Keyboard interaction

KeyBehavior
TabMove between pagination controls exposed as native buttons or links.
Enter / SpaceActivate the focused page or boundary control.
Home / EndThe terminal projection moves to the first or last page.

Accessibility

Page links or buttons keep native activation semantics and identify the current page without relying on position alone.

Released under the MIT License.