--- name: inertia-svelte-development description: "Develops Inertia.js v1 Svelte client-side applications. Activates when creating Svelte pages, forms, or navigation; using Link or router; or when user mentions Svelte with Inertia, Svelte pages, Svelte forms, or Svelte navigation." license: MIT metadata: author: laravel --- @php /** @var \Laravel\Boost\Install\GuidelineAssist $assist */ @endphp # Inertia Svelte development ## Documentation Use `search-docs` for detailed Inertia v1 Svelte patterns and documentation. ## Basic usage ### Page components location Place Svelte page components in the `{{ $assist->inertia()->pagesDirectory() }}` directory. ### Page component structure @boostsnippet("Basic Svelte Page Component", "svelte")

Users

@endboostsnippet ## Client-side navigation ### Basic Link component Use `` for client-side navigation instead of `` tags: @boostsnippet("Inertia Svelte Navigation", "svelte") Home Users View User @endboostsnippet ### Link with method @boostsnippet("Link with POST Method", "svelte") Logout @endboostsnippet ### Programmatic navigation @boostsnippet("Router Visit", "svelte") @endboostsnippet ## Form handling ### Using `router.post` @boostsnippet("Form with router.post", "svelte")
@endboostsnippet ## Inertia v1 limitations Inertia v1 does not support these v2 features: - `
` component - Deferred props - Prefetching - Polling - Infinite scrolling with `WhenVisible` - Merging props Do not use these features in v1 projects. ## Server-side patterns The inertia-laravel guidelines cover server-side patterns such as Inertia::render, props, and middleware. ## Common pitfalls - Using traditional `` links instead of Inertia's `` component (breaks SPA behavior) - Using Inertia v2 features, such as deferred props or the `` component, in v1 projects - Using `` without preventing default submission (use `on:submit|preventDefault`) - Not handling loading states during form submission