Skip to main content

@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