Skip to content
Inkoxide

Search covers every page and heading of the docs. Use ↑ ↓ and ↵.

Serving templates

Edit this page

@inkoxide/svelte/templates is the React guide's Serving templates for Svelte: a template is { meta: { id }, schema, Template, images? }, whose Template is a component with the prop data.

import { generate, type TemplateLike } from '@inkoxide/svelte/templates';
import { z } from 'zod';

import Invoice from './Invoice.svelte'; // let { data } = $props();

const schema = z.object({ number: z.string(), total: z.number() });
const invoice: TemplateLike<typeof schema> = { meta: { id: 'invoice' }, schema, Template: Invoice };

const { pdf } = await generate(invoice, { number: '2026-001', total: 120 });

Synced from packages/svelte/GUIDE.md in the inkoxide repository.