# Documentation for AI agents This file is generated at build time from the Markdown documentation. Use it to choose the most relevant page before reading the canonical HTML documentation. ## Router by Before Semicolon URL: https://router.beforesemicolon.com/ Source: docs/index.md Description: A tiny Web Component router for HTML-first apps. Declare links, routes, redirects, query routes, lazy pages, guards, and route data without framework lock-in. ::: layout landing-hero version="@beforesemicolon/router" title="Routing" title2="in plain HTML." primaryLabel="Get Started" secondaryLabel="$ npm i @beforesemicolon/router" === copy A tiny Web Component router for HTML-first apps. Route by pathname or search query, lazy-load HTML/JS/TXT pages, nest route layouts, guar ## What is Router? - HTML-First Web Component Routing URL: https://router.beforesemicolon.com/documentation/ Source: docs/documentation/index.md Description: Learn how Before Semicolon Router brings declarative, lazy, guarded, framework-agnostic routing to HTML, Web Components, SPAs, MPAs, and hybrid apps. What is Router? @beforesemicolon/router is a Web Component based routing solution for single-page apps, multi-page apps, and hybrid sites that want client-side navigation without adopting a framework router. It uses custom elements, so routes live in the same HTML structure as the views they control. You can start with ## Get Started with Router - Before Semicolon URL: https://router.beforesemicolon.com/documentation/get-started Source: docs/documentation/get-started.md Description: Build your first HTML-first Router app with page-link, page-route, page-data, lazy route files, and 404 redirects. Get Started Setting up routing does not require a route config file, wrapper framework, or build tool. A small app can be fully routed with HTML tags, and a larger app can move each view into lazy HTML or JavaScript route files. Let's build a simple multi-tab dashboard step-by-step: Step 1: Add the Scripts Import the r ## Install Router - Before Semicolon URL: https://router.beforesemicolon.com/documentation/installation Source: docs/documentation/installation.md Description: Install @beforesemicolon/router with npm, yarn, pnpm, or direct browser script tags for HTML-first Web Component routing. Installation @beforesemicolon/router works in bundled applications and directly in modern browsers through CDN script tags. Package Managers Install the package via your preferred package manager to bundle it with Vite, Webpack, or Esbuild: npm yarn pnpm Direct CDN (Zero-Build) For simple HTML prototypes or build-less ## Router Guide & Best Practices - Router by Before Semicolon URL: https://router.beforesemicolon.com/documentation/guide-best-practices Source: docs/documentation/guide-best-practices.md Description: Practical guidance for building maintainable HTML-first routing with Before Semicolon Router, including route structure, redirects, guards, links, and lazy loading. Guide & Best Practices Router works best when the URL is treated as the source of truth for navigation, filters, tabs, and shareable UI state. Keep route declarations close to the layout they control, then use the JavaScript API only for behavior that cannot be expressed cleanly in HTML. Start With Declarative Routes F ## AI Guide for Before Semicolon Router URL: https://router.beforesemicolon.com/documentation/ai Source: docs/documentation/ai.md Description: A compact reference for AI assistants and developers generating Router code, with accurate components, APIs, patterns, and constraints. AI Guide Use this page as the compact reference when generating examples, tutorials, migrations, or application code for @beforesemicolon/router. Package Purpose @beforesemicolon/router is an HTML-first routing library built with Web Components. It provides custom elements for navigation and route rendering, plus a sma ## Page Route Component - Router by Before Semicolon URL: https://router.beforesemicolon.com/documentation/web-components/page-route Source: docs/documentation/web-components/page-route.md Description: Learn how to render pathname routes, dynamic params, nested layouts, lazy route files, component props, loading slots, fallbacks, and route groups. `. `. `. `.