Skip to main content
The @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

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
This renders an <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 from import.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 pixels
  • height?: number — image height in pixels
  • alt?: string — alt text (default '')
  • transformations?: TransformOptions — transformation options
  • responsive?: boolean — responsive images (default true)
  • lazy?: boolean — lazy loading (default true)
  • sizes?: stringsizes attribute 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.