Skip to content
Eskais UI

Server data

URL Router

A router adapter for blocks that keep state in the URL: read the location, navigate, build an href and follow changes. hashRouter keeps a hash route's path (#/devices?device=a1), historyRouter the path and query string, memoryRouter is for tests; wrap your own router's API in the same shape.

Example

Location /devices?sort=name, 0 navigations

Installation

npx shadcn@latest add @eskais/url-router

Usage

Import
import { hashRouter, historyRouter, memoryRouter, withParam } from "@/lib/url-router"

API reference

This item exports functions and types rather than components.

Other exports

hashRouterhistoryRoutermemoryRouterwithParamtype MemoryRoutertype RouterWindowtype UrlLocationtype UrlNavigateOptionstype UrlRouter

Agent actions

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