Menu
Libraries |
Category

yrv

  • Built on top of abstract-nested-router with Svelte support (the v in yrv stands for Svelte)
  • Key features:
    • Nested routers support
    • Advanced route parameters (e.g. /:id<\d+>)
    • ARIA-compliant with [aria-current="page"] on active links
    • Seamless <base href> integration
    • Conditional rendering and redirection
    • Fallback route handlers
    • Supports both hash and URI-based routing
    • Query string support via query-string
    • Works with Svelte REPL

Core Components

  • <Router>: Container for routes with props for path derivation, pending states, conditions, and fallback control
  • <Route>: Main routing container with props for exact matching, dynamic components (including promises/imports), conditions, and redirects
  • <Link>: Navigation component with props for href, exact matching, history control, and window opening

Public API

  • navigateTo(): Programmatic navigation with reload/replace options
  • $router store: Provides route information similar to let:router in components
  • Route changes propagate through stores with detailed route info

Target Audience

  • Svelte developers needing a lightweight, nested routing solution
  • Projects requiring ARIA-compliant routing
  • Applications needing advanced route parameters or conditional routing
  • Environments where hash-based routing is preferred

Notable Details

  • Defaults to / path normalization (trailing slashes)
  • Supports IE11 with polyfills
  • Can be used in embedded apps like Electron
  • Provides debug version with additional warnings
  • Route subscriptions fire with initial property on first load

svelterouter

Comments