litestar-vite litestar-vite litestar-vite
  • Home
  • Docs
  • Code
/
  • Discussion

Litestar Vite Documentation

  • Usage
    • Vite Integration
    • Operation Modes
    • Type Generation
    • Inertia Integration
    • Migration Guide (v0.15)
  • Inertia.js
    • Installation
    • Configuration
    • How It Works
    • Pages
    • Responses
    • Redirects
    • Forms
    • Links
    • Routing & Navigation
    • Shared Data
    • Partial Reloads
    • Deferred Props
    • Merging Props
    • CSRF Protection
    • History Encryption
    • Templates
    • Error Handling
    • Asset Versioning
    • TypeScript Integration
    • Type Generation
    • Typed Page Props
    • Shared Props Typing
    • Fullstack Example
  • Framework Examples
    • React
    • Vue
    • Svelte
    • Angular
    • HTMX
    • Nuxt
    • SvelteKit
    • Astro
    • Inertia.js
  • API Reference
    • CLI
    • Code Generation
    • Commands
    • Config
    • CDN Deployment
    • Exceptions
    • HTML Transformation
    • Loader
    • Plugin
    • SPA Handler
    • InertiaJS Integration
      • Inertia Configuration
      • Inertia Exception Handler
      • Inertia Helpers
      • Inertia Middleware
      • Plugin
      • Inertia Request
      • Inertia Response
      • Inertia SSR (JS)
      • Inertia Types

Development

  • Changelog
  • Contribution guide

On this page

  • Inertia Link Component
  • Route Helper
  • Setup
  • See Also
litestar-vite 0 0
Edit this page
  1. litestar-vite /
  2. Inertia.js /
  3. Links
View Source Open in ChatGPT Open in Claude

Links¶

Client-side navigation and route helpers.

See also

Official Inertia.js docs: Links

Tip

Plain URLs work everywhere! You’re not required to use the route() helper. See Routing & Navigation for details on how litestar-vite compares to Laravel/Ziggy.

Inertia Link Component¶

Use the Inertia Link component for SPA navigation. Both plain URLs and the route() helper work:

import { Link } from "@inertiajs/react";

<Link href="/users">Users</Link>
<Link href="/users" method="post">Create User</Link>
<Link href="/logout" method="post" as="button">Logout</Link>
<script setup>
import { Link } from "@inertiajs/vue3";
</script>

<template>
  <Link href="/users">Users</Link>
  <Link href="/users" method="post">Create User</Link>
  <Link href="/logout" method="post" as="button">Logout</Link>
</template>

Route Helper¶

Generate URLs for named routes using the route() helper:

// Import from your generated routes file (output is driven by TypeGenConfig.output)
import { route } from "./generated/routes";

// Simple route
const homeUrl = route("home");  // "/"

// Route with parameters
const userUrl = route("user-profile", { userId: 123 });  // "/users/123"
// Use with Link
<Link href={route("user-profile", { userId: 123 })}>View Profile</Link>

Setup¶

Routes are generated at build/dev time into TypeGenConfig.output. Import the generated module in application code where you need route helpers.

See Also¶

  • Routing & Navigation - Comparison with Laravel/Ziggy, plain URL support

  • Type Generation - Typed routes

  • Inertia.js Links - Official docs

  • Inertia.js Manual Visits - Programmatic navigation

Previous
Forms
Next
Routing & Navigation

2025, Litestar-Org

Made with Sphinx and Shibuya theme.