Page Component + Zod Validation
Client-side wrapper component with Zod runtime validation. Most popular TypeScript schema validator (~14kb).
Component Wrapper + Zod Validation
Quick Start with CLI
Generate this entire pattern automatically:
During the interactive prompts, select Component Wrapper strategy and Zod validator, then define your fields (galleryTitle, imageCount).
How It Works
- Client-side only - No server load function required, uses simple component props
- Zod validation - Runtime validation with the most popular TypeScript schema validator (~14kb bundle)
- Wrapper component pattern - Create a component that calls
useLayoutRegions()to set region data - Type-safe props - Full TypeScript support with automatic type inference
- Simple API - Use like any other Svelte component with props
Code Examples (used on this page)
1. Define your schema with Zod:
2. Create a wrapper component that calls useLayoutRegions() to
set region data:
useLayoutRegions(), which validates and sets the region data
for consumption elsewhere in your layout.3. Consume the region in your layout (just like with load functions):
4. Use the wrapper component anywhere in your pages with simple props — the wrapper
handles calling useLayoutRegions(), which validates the data
and makes it available to the region consumer in your layout.