Skip to content

lit-ui-router / RoutedLitElement

Interface: RoutedLitElement

Defined in: packages/lit-ui-router/src/interface.ts:237

A LitElement class constructor that can be used in state declarations.

The class should extend LitElement and optionally accept UIViewInjectedProps in its constructor. The sticky property can be set to true to reuse the same component instance across state transitions.

Example

ts
class UserList extends LitElement {
  _uiViewProps?: UIViewInjectedProps;

  constructor(props?: UIViewInjectedProps) {
    super();
    this._uiViewProps = props;
  }

  render() {
    return html`<h1>Users</h1>`;
  }
}

router.stateRegistry.register({
  name: 'users',
  url: '/users',
  component: UserList,
});

Extended by

Constructors

Constructor

ts
new RoutedLitElement(props?): LitElement & {
  _uiViewProps?: UIViewInjectedProps<Record<string, any>>;
};

Defined in: packages/lit-ui-router/src/interface.ts:239

Constructor that accepts optional UIViewInjectedProps

Parameters

ParameterType
props?UIViewInjectedProps<Record<string, any>>

Returns

LitElement & { _uiViewProps?: UIViewInjectedProps<Record<string, any>>; }

Properties

PropertyTypeDescriptionDefined in
sticky?booleanIf true, the same component instance is reused across state transitionspackages/lit-ui-router/src/interface.ts:243