Build a contact form with SvelteKit form actions
Use SvelteKit's native `use:enhance` form actions to POST submissions to FormLoom progressively.
- 1
Add a +page.server.ts action
Create a `actions.default` that reads `formData`, builds an object, and POSTs it to FormLoom with `Accept: application/json`.
- 2
Attach use:enhance
In `+page.svelte`, add `use:enhance` to the form for progressive enhancement and show SvelteKit's action result.
- 3
Test with JS disabled
The form works without JavaScript too — SvelteKit handles both modes.
FAQ
Prefer the server action — it works without JavaScript and keeps the FormLoom key server-side (though the key is public anyway).