@repo/form
Schema-driven form generation for Svelte 5 with automatic field rendering from Zod schemas.
Quick Start
Define the schema
import { z } from 'zod'
const schema = z.object({
username: z.string()
})
For remote functions. Read more about TypedForm.Remote
<TypedForm.Remote form={createUserForm} {schema} />
For client functions. Read more about TypedForm.Client
<TypedForm.Client bind:value {schema} onsubmit={handleSubmit} />
Customize the fields by using zaf. Read more about zaf
import { z } from 'zod'
import { zaf } from '@repo/form'
const schema = z.object({
username: z.string()
password: zaf(z.string(), {
type: 'password'
})
})
Docs
- Remote vs Client - Which to use
- Remote Forms - Server actions with
formfrom$app/server - Client Forms - Client-side only with
bind:value - Customization - Custom layouts, full control mode
- zaf - Field labels, descriptions, custom components