# `IModelNode.tryOn`

> 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 [`IModelNode`](IModelNode.md) · inherited by [`ConfiguratorNode`](ConfiguratorNode.md) · labs, `@experimental` · since 2.0.0

```ts
tryOn?: {
  kind: TryOnKind;
  approved?: {
    format: number;
  };
};
```

The node's try-on rig record, which Holostep's rig pipeline writes and the runtime only reads:
`kind` is the body part the rig fits, and `approved` is set once a rig passed review, with
`format`, the rig file's format version the tracker checks. [`canTryOn()`](Session.canTryOn.md) and [`tryOn()`](Session.tryOn.md) use the
first enabled ModelNode on screen (following each GroupNode's selected child) that has one,
and only its approved rig, at [`tryOnUrl`](IModelNode.tryOnUrl.md); a candidate is never used.

**Default:** undefined (no rig: [`canTryOn()`](Session.canTryOn.md) answers `reason: 'no-rig'`)

## Fields

<a id="kind"></a>
### `kind`

```ts
kind: TryOnKind;
```

The body part the rig fits.

<a id="approved"></a>
### `approved`

```ts
approved?: { … }
```

Set once a rig passed review.

**Default:** undefined (no approved rig: no try-on)

<a id="approved.format"></a>
### `approved.format`

```ts
format: number;
```

The rig file's format version, which the tracker checks.

## 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/21-IModelNode.tryOn.ts`):

```ts
import { has } from '@holostep-configurators/runtime-client';
import type { IModelNode, Session } from '@holostep-configurators/runtime-client/contract';
declare const session: Session;
declare const signal: AbortSignal;
declare const glasses: IModelNode;           // a placed product, enabled
declare const rigUrl: string;                // the approved rig's GLB, an absolute URL
// A model with an approved face rig: canTryOn() reads it once the model commits.
await session.setSceneModel({
  root: [{ ...glasses, tryOn: { kind: 'face', approved: { format: 1 } }, tryOnUrl: rigUrl }],
});
export const tryOnShown = (): boolean =>
  has(session, 'canTryOn') && session.canTryOn().available;
```

## Generic-API test (spec 3.1)

| Rule | Result |
| --- | --- |
| 1. Neutral name | pass: `tryOn` 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) |
