Skip to content
Design System
GitHub

A server-paged list's query kept in the URL, so a filtered view is a link: page, limit, sortBy, order and search, read through list-query's grammar.

1–8 of 57 devices

Status
Device 001Hsinchu plantOffline
Device 002Taoyuan depotOnline
Device 003Tainan labOnline
Device 004Hsinchu plantOnline
Device 005Taoyuan depotOnline
Device 006Tainan labOffline
Device 007Hsinchu plantOnline
Device 008Taoyuan depotOnline

URL: ?limit=8 · request: ?page=1&limit=8

Table

Install
npx shadcn add @syncrobotic/use-list-query

Also installs: @syncrobotic/list-query, @syncrobotic/use-debounce

Overview

When to use

  • A list page whose filtered view should be a link people can share.
  • Back and forward that restore the search, sort and page.

Use something else

  • The grammar alone, with no React (a server component, a request): List query.
  • A list inside a dialog: pass memoryAdapter(), so the page's URL is left alone.

Usage rules

  • Bind the search box to search and setSearch: the box answers every key, the URL and the request wait for the pause. Clearing never waits.
  • A new search, sort, limit or filter goes back to page 1; only setPage keeps the rest.
  • In Next.js pass an adapter on the router (useSearchParams, useRouter, usePathname), so navigation goes through it; /docs/nextjs/data has the code.
  • Request with query, not with the box's text: the query is what the URL says.

Changelog

  • 0.64.02026-12-01Formatted with Prettier (class order sorted); the code is unchanged.
  • 0.55.02026-11-27First release: the query from the URL through an adapter (historyAdapter by default, memoryAdapter, or your router's), the search text ahead of the URL with a debounce, and a new search, sort, limit or filter back on page 1. setQuery and useSearchText for controlled blocks.

How to upgrade