Skip to content
PlaygroundForm Builder

Remote functions

Terminal window
npm i @sjsf/sveltekit

Required peer dependencies: @sjsf/form@3.5.0 @sveltejs/kit@2.61.0 esm-env@1.2.0 svelte@5.44.0

<script lang="ts">
import { BasicForm, createForm } from "@sjsf/form";
import { connect } from "@sjsf/sveltekit/rf/client";
import type { Model } from "$lib/post";
import * as defaults from "$lib/sjsf/remote-defaults";
import { createPost, getInitialData } from "./data.remote";
const initialData = await getInitialData();
const form = createForm(
await connect<Model>(createPost, {
...defaults,
...initialData,
})
);
</script>
<BasicForm {form} novalidate />
  • experimental.async does not apply to dependency code - issue.

    Add this to your vite.config.js

    optimizeDeps: {
    exclude: ['@sjsf/form', '@sjsf/sveltekit/rf/client'],
    }
  • The form.value type on the client side is unknown because the RemoteForm type does not include information about the validator’s output type. Specify the type via connect generic: createForm(await connect<FormValue>(...)).