@autorender/svelte SDK provides Svelte components — <ARImage> and <ARVideo> — that render optimized media from an Autorender delivery URL, an AutoRenderProvider for workspace config, and an autorenderUploader action for browser uploads.
Prerequisites
- An Autorender account with a workspace ID — create one in the dashboard
- A Svelte project
Guide
1
Install the package.
2
Set up the provider.
Wrap the components that need transformed images with
AutoRenderProvider:App.svelte
3
Render your first image.
Product.svelte
<img> resized to 400×400 px, cropped to fill, with a responsive srcset and lazy loading.Examples
Complete transform example
Hero.svelte
Video component
ProductVideo.svelte
Upload widget
The uploader runs in the browser, so read the API key fromimport.meta.env rather than hardcoding it.
Uploader.svelte
API reference
autorenderUploader (Svelte action)
Svelte action that mounts the uploader into a DOM element. Pass options as the action argument.
<ARImage />
Props:
src: string— image source path (required)width?: number— image width in pixelsheight?: number— image height in pixelsalt?: string— alt text (default'')transformations?: TransformOptions— transformation optionsresponsive?: boolean— responsive images (defaulttrue)lazy?: boolean— lazy loading (defaulttrue)sizes?: string—sizesattribute for responsive images
<ARVideo />
Video.js-based player. Props: src, width, height, controls, preload, transformations.
Next steps
Image transformations
Every parameter you can pass to
transformations.Direct upload API
The upload endpoint behind the uploader.
Video transformations
Resize, trim, and thumbnail video for
<ARVideo>.All SDKs
Front-end and backend SDKs for every stack.