State-based Routing
Organize your app with hierarchical states. Define URLs, components, and data requirements declaratively. Open states in the app below
Start minimal with simple, plain Lit templates and scale cleanly to non-trivial apps without switching routers. Built on @uirouter/core, the same engine behind UI-Router for Angular and React.
The feature cards above run here as a small lit-ui-router app. Each card re-enters one state with a new parameter, and the diagram follows each transition.
The app shares this page's URL fragment with the page's own anchors, so a link can open a card directly, as the links on the cards above do. For example, #see-it-run/views opens Views.
entered cardcardId: 'states'
The app registers one state, card, under the router's root state, at the URL /:cardId. It renders into the <ui-view> in <app-root>. Each card is a value of its cardId parameter: states, views, resolves.
The active value is states.