# @vaadin/router

> Small and powerful client-side router for Web Components. Framework-agnostic.

Latest version **2.0.1** (published 2025-11-14) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @vaadin/router
pnpm add @vaadin/router
yarn add @vaadin/router
bun add @vaadin/router
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2025-11-14 |
| First published | 2018-06-11 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 271.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 456 |
| Author | Vaadin Ltd |
| Maintainers | web-padawan, diegocardoso, alvarezguille, platosha, jouni, manolo, yuriyyev, vaadin-owner, tomivirkki, artur-, sunzhewyq, sissbruecker |
| Keywords | Vaadin, vaadin-router, router, client-side, web-components |

## Links

- npm: https://www.npmjs.com/package/@vaadin/router
- Repository: https://github.com/vaadin/vaadin-router
- Homepage: https://vaadin.com
- Issues: https://github.com/vaadin/vaadin-router/issues
- npm.io page: https://npm.io/package/@vaadin/router

## Dependencies (3)

- [type-fest](https://npm.io/package/type-fest.md) ^5.2.0
- [path-to-regexp](https://npm.io/package/path-to-regexp.md) ^6.3.0
- [@vaadin/vaadin-usage-statistics](https://npm.io/package/@vaadin/vaadin-usage-statistics.md) ^2.1.3

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 2.0.1 (latest) — 2025-11-14
- 2.0.0 — 2024-10-15
- 2.0.0-rc4 — 2024-10-09
- 2.0.0-rc3 — 2024-10-09
- 2.0.0-rc2 — 2024-10-08
- 2.0.0-rc1 — 2024-10-07
- 1.7.5 — 2023-03-21
- 1.7.4 — 2021-02-12
- 1.7.3 — 2021-01-29
- 1.7.2 — 2020-04-30
- 1.7.1 — 2020-02-26
- 1.7.0 — 2020-02-19
- 1.6.0 — 2019-12-19
- 1.5.2 — 2019-11-07
- 1.5.1 — 2019-10-24
- … 22 more at https://npm.io/package/@vaadin/router/versions

## README

[![NPM version](https://img.shields.io/npm/v/@vaadin/router.svg)](https://www.npmjs.com/package/@vaadin/router)
[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/@vaadin/router.svg)](https://bundlephobia.com/result?p=@vaadin/router)

# Vaadin Router is deprecated

This library is no longer actively maintained. Vaadin uses React Router as a primary client-side routing tool.

Consider [`@lit-labs/router`](https://www.npmjs.com/package/@lit-labs/router) as a more lightweight and modern alternative. Also, as the [URLPattern](https://developer.mozilla.org/en-US/docs/Web/API/URLPattern) API is universally available in modern browsers nowadays, we recommend using that for building customized client-side routing.

---

# Vaadin Router

[Live demo](https://vaadin.github.io/router/index.html)
| [API documentation](https://vaadin.github.io/router/API/index.html)

Vaadin Router is a small and powerful client-side router JS library. It uses the widely adopted express.js syntax for routes (`/users/:id`) to map URLs to Web Component views. All features one might expect from a modern router are supported: async route resolution, animated transitions, navigation guards, redirects, and more. It is framework-agnostic and works equally well with all Web Components regardless of how they are created (Polymer / SkateJS / Stencil / Angular / Vue / etc).

Vaadin Router is a good fit for developers that do not want to go all-in with one framework, and prefer to have freedom in picking the components that work best for their specific needs.

```
npm install --save @vaadin/router
```

```javascript
import {Router} from '@vaadin/router';

const router = new Router(document.getElementById('outlet'));
router.setRoutes([
  {path: '/', component: 'x-home-view'},
  {path: '/users', component: 'x-user-list'}
]);
```

## Browser support

A specific version of Vaadin Router supports the same browsers as the Vaadin platform major version which includes that version of Vaadin Router.
See [Vaadin platform release notes](https://github.com/vaadin/platform/releases) for details on included Vaadin Router version and supported technologies.
The Supported Technologies section is typically listed in the release notes of the first publicly available release of a Vaadin platform major version
(for example [Vaadin 18.0.1](https://github.com/vaadin/platform/releases/tag/18.0.1) since 18.0.0 was skipped).

### Desktop browsers

Evergreen versions of the following browsers
- Chrome, Firefox, Firefox ESR, Safari and Edge (Chromium)

### Mobile browsers

Built-in browsers in the following mobile operating systems:
- Safari starting from iOS 13 (Safari 13 or newer)
- Google Chrome evergreen on Android (requiring Android 4.4 or newer)

### Sauce Labs test status

[![Sauce Test Status](https://saucelabs.com/browser-matrix/vaadin-router.svg)](https://saucelabs.com/u/vaadin-router)

### Big Thanks

Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs](https://saucelabs.com).


## Running demos and tests in the browser

1. Fork the `vaadin/router` GitHub repository and clone it locally.

1. Make sure you have [npm](https://www.npmjs.com/) installed.

1. In the router directory, run `npm install` to install dependencies.

1. Run `npm run build` to build the library.

1. Run `npm start`, and open [http://localhost:4173](http://127.0.0.1:8000/components/vaadin-router) in your browser to see the component live demos and API documentation.

## Running tests from the command line

1. In the router directory, run `npm test`


## Following the coding style

We are using [ESLint](http://eslint.org/) for linting JavaScript code. You can check if your code is following our standards by running `npm run lint`, which will automatically lint all `.js` files as well as JavaScript snippets inside `.html` files.


## Contributing

  - Make sure your code is compliant with our code linters: `npm run lint`
  - Check that tests are passing: `npm test`
  - [Submit a pull request](https://www.digitalocean.com/community/tutorials/how-to-create-a-pull-request-on-github) with detailed title and description
  - Wait for response from one of Vaadin components team members


## License

Apache License 2.0

Vaadin collects development time usage statistics to improve this product. For details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.

---
_Source: https://npm.io/package/@vaadin/router · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
