Skip to content
PlaygroundForm Builder

svelte-jsonschema-form

Svelte 5 library for creating forms based on JSON schema.

Install as a community add-on using the Svelte CLI.

Terminal window
npx sv add @sjsf
<script lang="ts">
  import { BasicForm, createForm, getValueSnapshot } from "@sjsf/form";

  import * as defaults from "$lib/sjsf/defaults";

  import * as createUser from "../create-user";

  const form = createForm<createUser.Model>({
    ...defaults,
    ...createUser,
    onSubmit: ({ name }) => window.alert(`Hello, ${name}`),
  });
</script>

<BasicForm {form} />

<pre>{JSON.stringify(getValueSnapshot(form), createUser.withFile, 2)}</pre>

This project includes modifications of code from react-jsonschema-form, which is licensed under the Apache License, Version 2.0. The rest of the project is under the MIT license.