https://github.com/x0k/svelte-jsonschema-form
Svelte 5 library for creating forms based on JSON schema.
https://github.com/x0k/svelte-jsonschema-form
forms json-schema svelte svelte5
Last synced: 24 days ago
JSON representation
Svelte 5 library for creating forms based on JSON schema.
- Host: GitHub
- URL: https://github.com/x0k/svelte-jsonschema-form
- Owner: x0k
- License: mit
- Created: 2024-09-14T22:38:00.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-03-30T20:11:22.000Z (about 1 month ago)
- Last Synced: 2025-03-31T07:04:29.715Z (about 1 month ago)
- Topics: forms, json-schema, svelte, svelte5
- Language: TypeScript
- Homepage: http://x0k.online/svelte-jsonschema-form/
- Size: 3.74 MB
- Stars: 46
- Watchers: 1
- Forks: 4
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# svelte-jsonschema-form
Svelte 5 library for creating forms based on JSON schema.
Unofficial port of [react-jsonschema-form](https://github.com/rjsf-team/react-jsonschema-form).- [Documentation](https://x0k.github.io/svelte-jsonschema-form/v2/)
- [Playground](https://x0k.github.io/svelte-jsonschema-form/playground2/)## Installation
Install the library, basic theme and `ajv` for validation.
```shell
npm install @sjsf/form@next @sjsf/basic-theme@next @sjsf/ajv8-validator@next ajv@8
```## Usage
```svelte
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
})```
## License
This project includes modifications of code from [react-jsonschema-form](https://github.com/rjsf-team/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](LICENSE) and [LICENSE-APACHE](packages/form/LICENSE-APACHE) for details.
## See also
- [Other JSON Schema to Web UI tools](https://json-schema.org/tools?query=&sortBy=name&sortOrder=ascending&groupBy=toolingTypes&licenses=&languages=&drafts=&toolingTypes=schema-to-web-UI)
- [Converting JSON to table](https://github.com/x0k/json-to-table)
- [Simple build automation tool - mk](https://github.com/x0k/mk)