lit-ui-router / SrefHrefDirective
Class: SrefHrefDirective
Defined in: packages/lit-ui-router/src/sref-href.ts:35
The attribute-part sibling of UiSrefDirective: the same link, bound where the href lives instead of on the element.
render() is a function of the router and the arguments alone — it returns the href and touches no DOM — which is the shape a server renderer needs, since it runs render() and never update(). Everything that needs the element (finding the router, the click handler, the target event for an enclosing uiSrefActive) lives in update(), which only a live document runs. Handing the directive a router without an element is the remaining server-side piece.
See
srefHref for the public API
Extends
Properties
| Property | Type | Default value | Description | Defined in |
|---|---|---|---|---|
href | string | null | null | the href computed for the target, or null when there is none | packages/lit-ui-router/src/sref-href.ts:52 |
options | TransitionOptions | {} | the transition options from the last render | packages/lit-ui-router/src/sref-href.ts:41 |
params | RawParams | {} | the target state params from the last render | packages/lit-ui-router/src/sref-href.ts:39 |
state | string | null | null | the target state name from the last render | packages/lit-ui-router/src/sref-href.ts:37 |
targetState | | TargetState | null | null | the resolved target, or null until the router is found | packages/lit-ui-router/src/sref-href.ts:54 |
Methods
render()
render(
state,
params?,
options?
): string | typeof noChange | typeof nothing;Defined in: packages/lit-ui-router/src/sref-href.ts:86
The href for the target state; nothing when the state has no url; noChange until a router is found, so an attribute a server wrote survives hydration untouched.
Parameters
| Parameter | Type |
|---|---|
state | string |
params? | RawParams |
options? | TransitionOptions |
Returns
string | typeof noChange | typeof nothing
Overrides
AsyncDirective.render