Skip to main content
The @autorender/react SDK gives React two building blocks: <ARImage> and <ARVideo> components that render optimized, responsive media from an Autorender delivery URL, and an <AutorenderUploader> widget for uploading files from the browser.

Prerequisites

  • An Autorender account with a workspace ID — create one in the dashboard
  • A React project (Vite, Create React App, Next.js, or similar)

Guide

1

Install the package.

2

Set up the provider.

Wrap your app with AutoRenderProvider so child components can read your workspace configuration.
App.tsx
3

Render your first image.

Use <ARImage> in place of <img> for transforms, responsive srcset, and lazy loading.
ProductImage.tsx
This renders an <img> resized to 400×400 px, cropped to fill, with a responsive srcset and native lazy loading.

Examples

Complete transform example

AdvancedImage.tsx

Video component (Video.js)

ProductVideo.tsx
<ARVideo> accepts MP4, HLS (.m3u8), and DASH (.mpd) sources.

Upload widget

Pass the API key from an environment variable — the widget runs in the browser, so use a public-prefixed key scoped to uploads. Never hardcode the key.
App.tsx
For imperative access (calling .destroy() or .reset()), use the useAutorenderUploader hook:
App.tsx

API reference

<AutorenderUploader />

React component that wraps the uploader. Props: all CreateUploaderOptions except target, which the component handles.

<AutoRenderProvider />

React context provider that makes the AR instance available to child components. Props:
  • baseUrl?: string — base URL (default 'https://assets.autorender.io')
  • workspace: string — your workspace ID
  • defaults?: { f?: string, q?: string | number } — default transformations
  • enableDPR?: boolean — device-pixel-ratio handling (default true)
  • enableResponsive?: boolean — responsive images (default true)

<ARImage />

React component that wraps <img> with Autorender transformations. Props:
  • src: string — image source path (required)
  • width?: number — image width in pixels
  • height?: number — image height in pixels
  • transformations?: TransformOptions — transformation options
  • responsive?: boolean — responsive images (default true)
  • lazy?: boolean — lazy loading (default true)
  • sizes?: stringsizes attribute for responsive images
  • preset?: string — named preset mapped to a t_<preset> URL segment (e.g. preset="thumbnail"t_thumbnail)

useAutorenderUploader(options)

Hook that returns a ref to the uploader instance for imperative access (calling .destroy() or .reset()). Pass the ref to <AutorenderUploader> to populate it. Returns: MutableRefObject<UploaderInstance | null>

Next steps

Image transformations

Every parameter you can pass to transformations.

Direct upload API

The upload endpoint behind the widget.

Video transformations

Resize, trim, and thumbnail video for <ARVideo>.

All SDKs

Front-end and backend SDKs for every stack.