---
url: https://lit-ui-router.dev/guides.md
description: Task-oriented guides for lit-ui-router, grouped by topic
---

# Guides

New to the router? Start with [What is Lit UI Router?](/introduction), then
the [tutorial](/tutorial/helloworld).

Task-oriented pages for the concepts real apps hit after the tutorial. Each
guide is grounded in the
[sample app](/sample-app)'s working implementation — a webmail + contacts
client deployed across every point on the server-support spectrum.

## URLs & Location

* [Location Plugins](./location-plugins) — choosing a URL strategy: hash,
  pushState, or the Navigation API; server rewrites, the `<base>` tag, and
  the `initial` rule
* [State Parameters](./state-parameters) — path, query, typed, optional,
  `squash`, dynamic, and non-URL parameters, plus custom parameter types
* [Unmatched URLs (404)](./unmatched-urls) — route URLs that match no state
  to a deliberate 404 state with `urlService.rules.otherwise`

## Transitions & Guards

* [Route Guards](./route-guards) — protect states with transition hooks: the
  `requiresAuth` pattern, redirect-to-login, and returning the user after
  authentication
* [Redirects](./redirects) — static and dynamic `redirectTo` on states,
  transition-hook redirects, and `urlService.rules` (`initial`, `when`,
  `otherwise`)
* [Loading and Error Views](./loading-and-error-views) — a pending indicator
  while a transition runs, skeletons for `NOWAIT` resolves, and an error view
  with retry when a transition fails

## Views & Links

* [Routed Components](./routed-components) — reading a state's params
  through a resolve, code-splitting a route's element with an awaited import
  or a `lazyLoad` future state, and reaching the element a view rendered
* [Named Views](./named-views) — fill several `<ui-view name="…">` viewports
  from one state with `views`, and target a view another state created with
  `name@state`, relative `^` anchors and absolute `!` paths
* [View Fallback Content](./view-fallback-content) — what a `<ui-view>`
  renders when no routed component is active: the capture rules, the
  list/detail idiom, and what a prerendered shell emits
* [Component Lifecycle Hooks](./component-lifecycle) — `uiCanExit` for
  unsaved-changes prompts and `uiOnParamsChanged` for dynamic parameters
* [Links and Navigation](./links-and-navigation) — declarative links with
  `uiSref`, active classes and `aria-current` with `uiSrefActive`, relative
  targets, attribute-part `sref*` forms, `SrefStatusController`, and
  programmatic navigation with `stateService`
* [Design System Links](./design-system-links) — driving a design system's
  link component (`<sp-link>`, `<md-*>`, an in-house one) with `uiSref`:
  `assignHref: true` is the option for a custom element that declares its own
  `href`, and `'auto'` scopes the attribute to real `<a>` elements, with a
  live example contrasting all three cases

## Reactivity

* [Reactive Components](./reactive-components) — keep components outside
  `<ui-view>` in sync with the router using the zero-dependency
  `TransitionController`

## Server-side

The [server-side overview](/guides/server) maps the verdict, render and host
choices to the pages below.

* [Server-Side Routing](./server-route-matching) — serve routing verdicts
  at the edge with `ui-router-server`: the app shell for real routes, 302
  entry redirects, and real 404s for everything else, across the full
  server-support spectrum (every level [live on the site](/sample-app)), and
  [`lit-ui-router-ssr`](/packages/lit-ui-router-ssr) for prerendering those verdicts to
  static html at build time
* [Prerender with Vite](./prerender-with-vite) — one `serverRouterPlugin`
  option and a prerender script turn `vite build` into one HTML page per
  route, a `404.html` and a `_redirects` file, decided by the app's own route
  table
* [Prerender with Eleventy](./prerender-with-eleventy) — Eleventy writes the
  pages, the layout and the host rules; `prerender()` decides what each path
  is and renders it, and the client adopts the served page

## Builds & Diagnostics

* [Development and Production Builds](./development-builds) — the `development`
  export condition, the warnings the development build carries and the
  production build cannot print, and which packages ship two builds at all
* [Linting](./linting) — catch routing mistakes at author time with
  `eslint-plugin-lit-ui-router`, where lint sits beside typed routes and
  development warnings, and pointers for the rest of your Lit code
* [Tracing Transitions](./tracing) — instrument transitions in production with
  `ui-router-otel` and OpenTelemetry: param allowlists and message redaction,
  active spans across resolves, hooks and lazy loads, and shipping to an OTLP
  backend or the devtools Timeline

## Coming from Another Router

* [Coming from UI-Router](./coming-from-ui-router) — side-by-side mapping from
  `@uirouter/angular` and `@uirouter/react` to `lit-ui-router`, what stays
  identical in `@uirouter/core`, and what changes in Lit

## Companion Packages

The [companion packages](/packages/) — Effect, MobX and Signals bindings, the
Navigation API location plugin, typed state names, server-side routing
verdicts, static prerendering, development tooling, ESLint rules and OpenTelemetry spans — are optional and
independently versioned, each with its own guide and API reference.
