A clickable element that triggers client-side navigation to a named route.
<r-link name="home">Home</r-link>
<r-link name="about">About Us</r-link><r-link name="user" param-id="123">View User</r-link>
<r-link name="product" param-id="456" param-tab="details">Product Details</r-link>HTML lowercases attribute names, so param-programId reaches the DOM as param-programid. Two ways to target a route parameter declared as :programId:
<r-link name="program" param-program-id="42">Open</r-link>
<r-link name="program" param-programId="42">Also works</r-link>The kebab-case form (param-program-id) is converted to camelCase (programId) before navigation. The camelCase form is recovered through case-insensitive lookup against the route definition. Either way, the component receives the parameter under the route-defined name (programId).
For complex values, prefer the params JSON attribute below — JSON keys preserve their casing exactly.
<r-link name="settings" target="sidebar">Settings</r-link>
<r-link name="preview" target="modal">Preview</r-link>Use direction="back" or direction="forward" to step through a target's navigation history. Combine with target to control a specific named target; omit target to control the default one.
<r-link direction="back">Back</r-link>
<r-link direction="forward">Forward</r-link>
<r-link direction="back" target="modal">Close step</r-link>When there is no history to walk, the element sets aria-disabled="true" so CSS can style it:
r-link[aria-disabled="true"] {
opacity: 0.4;
pointer-events: none;
}name, param-*, and params are ignored when direction is set.
<r-link name="search" params='{"query":"typescript","page":1}'>
Search Results
</r-link>| Attribute | Type | Description |
|---|---|---|
name |
string |
Route name to navigate to (required, unless direction is set) |
target |
string |
Target r-route-target name |
params |
string |
JSON object with additional route data |
param-* |
string |
Individual route parameters (e.g., param-id="123"). Kebab-case is converted to camelCase (param-program-id → programId). |
direction |
'back' | 'forward' |
Walks the target's history instead of navigating to a route. Sets aria-disabled="true" when no history is available. |
- Renders as an inline element with
cursor: pointer - Sets
role="link"andtabindex="0"for accessibility - On click, calls
navigate()with the route name and collected parameters - Prevents default click behavior
Both param-* attributes and params JSON can be used together:
<r-link name="product"
param-id="789"
params='{"source":"email","campaign":"summer"}'>
View Product
</r-link>All parameters are merged into a single flat object:
{ id: '789', source: 'email', campaign: 'summer' }Style as any inline element:
r-link {
color: var(--accent-primary);
text-decoration: underline;
}
r-link:hover {
color: var(--accent-hover);
}
r-link:focus {
outline: 2px solid var(--accent-primary);
outline-offset: 2px;
}| Feature | <a href> |
<r-link> |
|---|---|---|
| Navigation | Full page reload | Client-side routing |
| Parameters | Query string | Route params + data |
| Target | Window/frame | Route target |
| SEO | Crawlable | Requires SSR |
Use <r-link> for SPA navigation within the app. Use native <a> for external links or when SEO is critical.