Skip to content

lit-ui-router / UiSrefActiveDirective

Class: UiSrefActiveDirective ​

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

Directive class that adds CSS classes based on active state.

This directive is used internally by the uiSrefActive directive function. It watches the current router state and applies CSS classes to elements when their associated states are active.

The directive can operate in two modes:

  1. Explicit state: Provide a state name to watch
  2. Container mode: Automatically watch nested uiSref directives

See ​

Extends ​

Properties ​

PropertyTypeDefault valueDescriptionDefined in
activeboolean | undefinedundefinedwhether any target is active, or undefined before the first statuspackages/lit-ui-router/src/ui-sref-active.ts:263
activeClassesstring[][]classes applied while any target is activepackages/lit-ui-router/src/ui-sref-active.ts:234
ariaCurrentValue| false | AriaCurrentValue | AriaCurrentValues | undefinedundefinedundefined = default (on for link elements)packages/lit-ui-router/src/ui-sref-active.ts:238
enteringboolean | undefinedundefinedwhether a running transition enters a targetpackages/lit-ui-router/src/ui-sref-active.ts:267
exactboolean | undefinedundefinedwhether any target is exactly active, or undefined before the first statuspackages/lit-ui-router/src/ui-sref-active.ts:265
exactClassesstring[][]classes applied while any target is exactly activepackages/lit-ui-router/src/ui-sref-active.ts:236
exitingboolean | undefinedundefinedwhether a running transition exits a targetpackages/lit-ui-router/src/ui-sref-active.ts:269
optionsTransitionOptions{}the explicit target transition optionspackages/lit-ui-router/src/ui-sref-active.ts:260
paramsRawParams{}the explicit target state paramspackages/lit-ui-router/src/ui-sref-active.ts:258
statestring | undefinedundefinedthe explicit target state name, or undefined in container modepackages/lit-ui-router/src/ui-sref-active.ts:256
targetStatesSet<TargetState>...every target this directive watches: the explicit one, or the enclosed links'packages/lit-ui-router/src/ui-sref-active.ts:272