svelte-jsonschema-form
Svelte 5 library for creating forms based on JSON schema.
Installation
Section titled “Installation”Install as a community add-on using the Svelte CLI.
npx sv add @sjsfpnpx sv add @sjsfyarn dlx sv add @sjsfbunx sv add @sjsfdeno x 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>
Supported Themes
Section titled “Supported Themes”- Basic
- daisyUI v5
- Flowbite Svelte
- Skeleton v4
- shadcn-svelte
- shadcn-svelte-extras (experimental)
- SVAR (experimental)
- Beer CSS (experimental)
Supported Validators
Section titled “Supported Validators”- Ajv v8
- Zod v4
- Valibot
- @cfworker/json-schema
- @exodus/schemasafe
- Standard Schema
- ata-validator (experimental)
- Precompiled (experimental)
- @hyperjump/json-schema (experimental)
Integrations
Section titled “Integrations”- Generic backend
- Form actions
- Remote functions (experimental)
License
Section titled “License”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.