---
title: "@tryonit/react: Virtual Try-On Components for React"
description: "React components and hooks that add a \"Try it on\" button to any product page, with full theming and a headless API for Next.js, Remix and Vite."
url: "https://arbabnaseer.com/projects/tryonit-react-virtual-try-on-components/"
lang: "en"
author: "Arbab Naseer"
dateModified: "2026-11-02T15:22:30+05:00"
---

# @tryonit/react: Virtual Try-On Components for React

> React components and hooks that add a "Try it on" button to any product page, with full theming and a headless API for Next.js, Remix and Vite.

npm package · Open source · Arbab Naseer · https://arbabnaseer.com/projects/tryonit-react-virtual-try-on-components/

- My role: Author & maintainer
- Year: 2026
- Platforms: Web
- Stack: React, TypeScript, Next.js, Remix, Headless hooks, Accessibility
- Licence: MIT
- Install: `npm install @tryonit/react three`

## Problem, solution and impact

**Problem:** Online shoppers cannot see how makeup, glasses or jewellery look on them, which causes doubt before buying. Adding try on to a React store is a big custom job.

**Solution:** I built React components and hooks that add a "Try it on" button to any product page, with full theming and a headless API for Next.js, Remix and Vite.

**Impact:**

- Shoppers see the product on their own face or hand before they buy
- A React store adds try on with one component instead of a custom build
- The dialog works with a keyboard and screen readers
- About 7.9 KB gzipped, so product pages stay fast

## Overview

@tryonit/react is the package most stores use from TryOnIt, the open-source virtual try-on SDK I built. One line, <TryOnButton asset="/tryon/aviator.json" />, adds a button that opens an accessible try-on dialog with the live camera, a product switcher, shade swatches, an intensity slider, a before and after comparison and a capture preview with download and share. It wraps the [@tryonit/web](https://arbabnaseer.com/projects/tryonit-web-browser-virtual-try-on-engine/) engine and needs no provider for the simple case.

I designed it so a store never has to fight the UI. Theme tokens become CSS custom properties with no CSS-in-JS runtime. Every slot accepts a class name, and the stylesheet uses low-specificity selectors so yours win without !important. An unstyled mode removes the visuals but keeps layout and accessibility, slots replace whole sub-components, and headless hooks such as useTryOn and useTryOnState let a team build the interface from scratch. Every string, icon and image is replaceable, including right-to-left layouts.

Per-frame tracking data never passes through React state, so re-renders stay rare, and useTryOnState only re-renders when the slice you select changes. Components are SSR safe and ship with "use client", so Next.js App Router pages import them directly. The package is about 8 KB min+gzip, and its dialog has a focus trap, Escape to close, focus return and screen reader announcements.

## Key features

- Drop-in <TryOnButton> that preloads models on hover or when visible
- Accessible dialog: focus trap, Escape, focus return and live status
- Theme tokens, class names per slot, unstyled mode and replaceable slots
- Headless hooks: useTryOn, useTryOnState, useCamera, useAsset, useCapture
- SSR safe for the Next.js App Router, Pages Router and Remix
- Replaceable labels and icons, dark mode and right-to-left layouts

## Links

- [npm](https://www.npmjs.com/package/@tryonit/react)
