A
A client-side anchor.
A client-side anchor. Plain clicks navigate through the router; modified clicks, target,
download, rel="external", absolute URLs and unsafe schemes are left to the browser. The
anchor reports its active state (activeClass, aria-current="page") and preloads its target on
intent or when it scrolls into view.
The anchor is built by element (from @shadow-js/web): attributes are bound one by one in render effects,
events are native listeners, and no generic prop runtime is linked. Server rendering writes the same markup as before,
with the same hydration keys.
Import#
ts
import { A } from "@shadow-js/router";
Signature#
ts
function A<P extends HrefOf = never>(props: AProps<P>): unknown
Parameters#
| Name | Description |
|---|---|
props |
See AProps. |
Returns#
An <a> element (or its server markup).
Throws#
- TypeError when rendered outside a
RouterProvider.
Examples#
ts
<A to="/posts/:id" params={{ id: "7" }} activeClass="current">Post 7</A>