# `TryOnOptions.mode`

> Contract 2.0.0 · package sha256 `a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e` · generated from `configurator-runtime.d.ts` by `services/onsite-scripter/scripts/build-contract-docs.mjs`; edit the source, not this file.

Property of [`TryOnOptions`](TryOnOptions.md) · labs, `@experimental` · since 2.0.0

```ts
mode?: 'auto' | 'here' | 'handoff';
```

'auto' picks for this device, which is 'here'; 'here' this page; 'handoff' a phone: Holostep's
hand-off screen shows a QR code of [`returnUrl`](TryOnOptions.returnUrl.md) (or this page's address) and the same link to
copy, in [`overlayRoot`](TryOnOptions.overlayRoot.md) or a layer over the page, and the shopper opens it on a phone, where
the page's own Try-on control starts the camera. This page sees nothing of the phone. Offer
it where [`canTryOn().modes`](TryOnAvailability.modes.md) lists 'handoff', after [`supports('tryOn.mode.handoff')`](Session.supports.md) (where it
answers false the call resolves 'unsupported').

**Default:** 'auto'

## Example

Imports: values (`has`, `validate`, the `Holo*Error` classes, the pure helpers) from `@holostep-configurators/runtime-client`, types from `@holostep-configurators/runtime-client/contract`, `/math` and `/testing` names from those entries; `boot` from the runtime module the root's `loadRuntimeAtFloor` resolves to. A type your page defines is your app's: declare it there, never import it from the package.

Compiled under the contract's strict settings (`examples/declaration/16-TryOnOptions.mode.ts`):

```ts
import { has } from '@holostep-configurators/runtime-client';
import type { Session } from '@holostep-configurators/runtime-client/contract';
declare const session: Session;
declare const signal: AbortSignal;
declare const onComputer: boolean; // the page's own device test: a phone can't scan itself
declare function showPhoneButton(visible: boolean): void;
// A computer offers try-on with a phone where the hand-off can open.
const modes = has(session, 'canTryOn') ? session.canTryOn().modes : [];
const offer = session.supports('tryOn.mode.handoff') && modes.includes('handoff');
showPhoneButton(onComputer && offer);
// In that button's click handler: the QR code opens this product's page on the phone.
const report = await session.tryOn?.({ mode: 'handoff', returnUrl: location.href, signal });
if (report && !report.launched) showPhoneButton(false);
```

## Generic-API test (spec 3.1)

| Rule | Result |
| --- | --- |
| 1. Neutral name | pass: `mode` names no product |
| 2. A precedent | pass: [model-viewer canActivateAR and activateAR()](https://modelviewer.dev/docs/index.html#entrydocs-augmentedreality-methods-activateAR) (row `G66`); [XRSession.end()](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/end) (row `G66`); [Navigator.share() (resolves when the share UI closes)](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share) (row `G66`) |
| 3. Two apps, or labs | labs (`@experimental` at a stable path, reached through `has()` or `supports()`): it graduates when a second app uses it; apps today: configurator-template, tryon-template |
| 4. The cheaper fix first | decided per need in Appendix B: rows `G66` at tier labs (a member only where no rule, data, asset or app code serves the need) |
