--- 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. --- @php /** @var \Laravel\Boost\Install\GuidelineAssist $assist */ @endphp # Inertia Svelte Development ## When to Apply Activate this skill when: - Creating or modifying Svelte page components for Inertia - Working with forms in Svelte (using `router.post`) - Implementing client-side navigation with `` or `router` - Building Svelte-specific features with the Inertia protocol ## Documentation Use `search-docs` for detailed Inertia v1 Svelte patterns and documentation. ## Basic Usage ### Page Components Location Svelte page components should be placed in the `resources/js/Pages` 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 traditional `` 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 Server-side patterns (Inertia::render, props, middleware) are covered in inertia-laravel guidelines. ## Common Pitfalls - Using traditional `` links instead of Inertia's `` component (breaks SPA behavior) - Trying to use Inertia v2 features (deferred props, `` component, etc.) in v1 projects - Using `` without preventing default submission (use `on:submit|preventDefault`) - Not handling loading states during form submission