Skip to content

lit-ui-router / SrefActiveClassDirective

Class: SrefActiveClassDirective ​

Defined in: packages/lit-ui-router/src/sref-active.ts:369

The attribute-part sibling of UiSrefActiveDirective's class handling, with the contract of lit's classMap: bound in class, alone or beside static classes, and toggling only the classes it names.

The first commit writes the whole class list — statics plus whichever of ours apply — as classMap does, which is also what a server rendering render() alone would emit. Every commit after that toggles names on classList, so classes something else added to the element survive.

See ​

srefActiveClass for the public API

Extends ​

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in
directiveNamereadonlystringthe public function's name, for errors and warningsSrefStatusDirective.directiveNamepackages/lit-ui-router/src/sref-active.ts:101
paramspublic| SrefActiveClassParams | undefinedthe last params update() sawSrefStatusDirective.paramspackages/lit-ui-router/src/sref-active.ts:75
statuspublicSrefStatus | undefinedmerged status of every target, or undefined before there is oneSrefStatusDirective.statuspackages/lit-ui-router/src/sref-active.ts:77

Methods ​

render() ​

ts
render(params): string | typeof noChange;

Defined in: packages/lit-ui-router/src/sref-active.ts:419

The classes that apply, space-padded to keep clear of the statics; or noChange before a status exists.

Parameters ​

ParameterType
paramsSrefActiveClassParams

Returns ​

string | typeof noChange

Overrides ​

SrefStatusDirective.render