Live Demo ↗ | API documentation ↗
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
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'}
]);
Cross-browser Testing Platform and Open Source <3 Provided by Sauce Labs.
-
Fork the
vaadin-router
repository and clone it locally. -
Make sure you have npm installed.
-
When in the
vaadin-router
directory, runnpm install
and thennpm run install:dependencies
to install dependencies. -
Run
npm start
, and open http://127.0.0.1:8000/components/vaadin-router in your browser to see the component API documentation. -
You can also open demo or in-browser tests by adding demo or test to the URL, for example:
- http://127.0.0.1:8000/components/vaadin-router/demo
- Public API tests: http://127.0.0.1:8000/components/vaadin-router/test
- Unit tests: http://127.0.0.1:8000/components/vaadin-router/test/index.coverage.html
- When in the
vaadin-router
directory, runnpm test
We are using ESLint 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.
- Make sure your code is compliant with our code linters:
npm run lint
- Check that tests are passing:
npm test
- Submit a pull request with detailed title and description
- Wait for response from one of Vaadin components team members
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.