Skip to content
Eskais UI

Server data

Page Source

A backend-agnostic contract for paged data (PageSource, PageRequest, PageResult), the kit adapters are built with, an in-memory arraySource, and createPageController, which derives the request, resets paging, debounces search, syncs the URL and writes the live region's status. Backend adapters are items of their own: page-source-rest, page-source-spring, page-source-cursor, page-source-relay and page-source-link.

Example

  • Ada 1
  • Grace 2
  • Alan 3
  • Edsger 4
  • Barbara 5
Showing 1–5 of 42 · page 1 · pages

Installation

npx shadcn@latest add @eskais/page-source
Brings alongnarrow

Adapters

Each adapter is an item of its own that brings page-source along. Install only the ones your backend needs.

  • Page Source REST

    page-source-rest
    npx shadcn@latest add @eskais/page-source-rest
  • Page Source Spring

    page-source-spring
    npx shadcn@latest add @eskais/page-source-spring
  • Page Source Cursor

    page-source-cursor
    npx shadcn@latest add @eskais/page-source-cursor
  • Page Source Relay

    page-source-relay
    npx shadcn@latest add @eskais/page-source-relay
  • page-source-link
    npx shadcn@latest add @eskais/page-source-link

Usage

Import
import {  abortError,  adapterSource,  appendParams,  capPageSize,  capPageSizes,  cursorPositionOf,  formatCount,  HttpError,  isAbortError,  isPagePosition,  pageCountOf,  pageNumberOf,  pageRange,  pageStatusLabels,  readJson,  resolveNavigation,  restCallOf,  totalOf,  writeSort,} from "@/lib/page-source"import { arraySource } from "@/lib/array-source"import { createPageController } from "@/lib/page-controller"

Wrap your endpoint in the adapter that matches its paging, once per resource; components and hooks only see the PageSource. Each adapter is its own item: install only the one your backend speaks.

API reference

This item exports functions and types rather than components.

Other exports

abortErroradapterSourceappendParamscapPageSizecapPageSizescursorPositionOfformatCountHttpErrorisAbortErrorisPagePositionpageCountOfpageNumberOfpageRangepageStatusLabelsreadJsonresolveNavigationrestCallOftotalOfwriteSortarraySourcecreatePageControllertype AdapterIdentitytype CursorPositiontype Navigationtype NavigationModetype PagePositiontype PageRangetype PageRequesttype PageResulttype PageSourcetype PageStatusLabelstype ParamsInittype ParamValuetype RestCalltype RestSourceOptionstype SortDirectiontype SortSpectype SortStyletype SourceCapabilitiestype SourceContexttype TotalInfotype ArraySortValuetype ArraySourceOptionstype PageCodecLiketype PageControllertype PageControllerOptionstype PageControllerStatetype UrlAdapterLiketype UrlHistory

Agent actions

Nothing of its own: the table, list and combobox built on it expose paging, sorting and filtering by name.

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.