SvelteKit Form Code Examples

See what SvelteForms generates. Pick a template to view the output code.

import { z } from 'zod';

export const contactFormSchema = z.object({
  full-name: z.string().min(2, 'Name must be at least 2 characters'),
  email: z.string().email('Please enter a valid email'),
  subject: z.string(),
  message: z.string().min(10, 'Message must be at least 10 characters').max(1000, 'Message must be under 1000 characters')
});

export type ContactFormSchema = typeof contactFormSchema;
Build Your Own Form

Need help integrating? Read the integration guide.