@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 This renders an
<ARImage> in place of <img> for transforms, responsive srcset, and lazy loading.ProductImage.tsx
<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
.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 IDdefaults?: { f?: string, q?: string | number }— default transformationsenableDPR?: boolean— device-pixel-ratio handling (defaulttrue)enableResponsive?: boolean— responsive images (defaulttrue)
<ARImage />
React component that wraps <img> with Autorender transformations.
Props:
src: string— image source path (required)width?: number— image width in pixelsheight?: number— image height in pixelstransformations?: TransformOptions— transformation optionsresponsive?: boolean— responsive images (defaulttrue)lazy?: boolean— lazy loading (defaulttrue)sizes?: string—sizesattribute for responsive imagespreset?: string— named preset mapped to at_<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.