Skip to content

lit-ui-router / UiSrefActiveDirective

Class: UiSrefActiveDirective ​

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

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