@sjsf/form v2.0.1
@sjsf/form
Svelte 5 library for creating forms based on JSON schema. Unofficial port of react-jsonschema-form.
Installation
Install the library, basic theme and ajv
for validation.
npm install @sjsf/form @sjsf/basic-theme @sjsf/ajv8-validator ajv@8
Usage
<script lang="ts">
import { createForm, BasicForm, type Schema } from '@sjsf/form';
import { resolver } from '@sjsf/form/resolvers/basic';
import { translation } from '@sjsf/form/translations/en';
import { theme } from '@sjsf/basic-theme';
import { createFormValidator } from "@sjsf/ajv8-validator";
const validator = createFormValidator();
const schema: Schema = {
title: 'Tasks',
type: 'array',
items: {
type: 'object',
properties: {
name: {
type: 'string',
title: 'Name',
},
description: {
type: 'string',
title: 'Description',
},
},
required: ["name"]
},
}
const form = createForm({
theme,
schema,
resolver
validator,
translation,
onSubmit: console.log
})
</script>
<BasicForm {form} />
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.
See LICENSE-MIT and LICENSE-APACHE for details.
See also
2 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
5 months ago
7 months ago
3 months ago
9 months ago
3 months ago
9 months ago
3 months ago
3 months ago
9 months ago
3 months ago
5 months ago
5 months ago
5 months ago
5 months ago
2 months ago
2 months ago
6 months ago
7 months ago
7 months ago
8 months ago
9 months ago
9 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago