Overview
RenderOptions is a configuration object passed to the Renderer.render() method to control how a specific Svelte component is rendered.
Type Definition
Properties
Props to pass to the Svelte component being rendered.This object contains the data your component needs. The keys should match the prop names defined in your Svelte component’s
<script> tag.Note: The special Svelte properties $$slots and $$events are excluded from the type since they’re not applicable in SSR contexts.Example:Context map for Svelte’s context API (
getContext/setContext).This allows you to provide context values that child components can access using Svelte’s getContext() function. Useful for dependency injection patterns.Example:Prefix for component-generated IDs to avoid collisions.If your Svelte component generates IDs (for
<label> elements, ARIA attributes, etc.), this prefix ensures they don’t collide when rendering multiple emails or components.Example:Usage Examples
Without any options
With props only
With context
With ID prefix
Complete example with all options
Rendering multiple emails with unique IDs
Component Example
Here’s what a Svelte email component might look like that uses these props:Type Safety with TypeScript
For better type safety, you can use Svelte’s component types:See Also
- Renderer - The Renderer class
- RendererOptions - Configuration options for the Renderer