← All examplesApplication / iframe

Router & History API

Live route navigation isolated within an iframe; inspect the router and page components individually.

01 / Live preview● Interactive
Interact with the component. The source on the right is the actual code.
Zidom JS / Example sourceREAD ONLY
src›demos›router.tsx
router.tsx
●  Zidom
import { createRouter, type Route } from '@zidomjs/router';import { RouterHome } from './router-home';import { RouterProfile } from './router-profile';// The demo runs in an iframe so History API navigation leaves the docs URL alone.let navigate: (path: string) => void = () => {};const routes: Route<Record<string, never>>[] = [  {    path: '/lab/router/',    component: () => <RouterHome onNavigate={navigate} />  },  {    path: '/lab/router/profile/',    component: () => <RouterProfile onNavigate={navigate} />  },  {    path: '*',    component: () => <p role="status">Page not found</p>  }];export function mountRouterDemo(host: HTMLElement) {  const router = createRouter({ routes, context: {} });  navigate = path => { void router.navigate(path); };  return router.mount(host);}
● zidom / routerTSX · UTF-8 · Copyable source

This website demo runs pinned Zidom beta.1 packages; the latest framework release is beta.2. See release details and limitations. Report a problem with this example.