Safe Vault
A photographic safe that opens with a combination: SafeDial on its door, and once the app checks the code and unlocks it, the bolts draw back, the door swings open and the camera moves in to a plaque on the back wall that holds your contents as real DOM, mapped onto the wall in perspective. A wrong code shakes the dial. The three.js scene draws in a worker after the controls paint; without WebGL the drawn door stays and the contents show under it.
Example
Installation
lucide-reactthree@0.185.1Usage
Reach for it where revealing something is the moment: a secret, a reward, a recovery code or an invite behind a combination. Check the code yourself in onComplete and set status; the vault only plays the result.
API reference
SafeVault
| Prop | Type | Default |
|---|---|---|
labelrequiredThe accessible name of the vault and its dial. | string | – |
statusrequiredSet by the app once it has checked the code from `onComplete`: `denied` shakes the dial and clears the code. | SafeVaultStatus | – |
onStatusChangeAsks the app for a new status: `locked` from the Lock button (shown only with this handler), and `locked` again once a denial has played, so a second wrong code can be denied too. | (status: SafeVaultStatus, details: SafeVaultStatusChangeDetails) => void | – |
onCompleteRuns with the whole code when the last number is entered: check it and set `status`. | (code: string) => void | – |
valueThe code as digits, each number padded to the same width. Pass it to control the code. | string | – |
defaultValue | string | "" |
onValueChange | (value: string, details: SafeDialChangeDetails) => void | – |
lengthHow many numbers the combination has; 4 by default. | number | 4 |
numbersHow many numbers the dial carries, from 0; 100 by default. | number | 100 |
mask | boolean | false |
disabled | boolean | false |
name | string | – |
childrenWhat the vault holds. It isn't in the page until `status` is `unlocked`, and can't be used until the door is open. Once locked it can't be used or read at once, and leaves the page when the door has shut over it. | ReactNode | – |
labels | Partial<SafeVaultLabels> | – |
classNameClasses for the root; a function gets the vault's state. | string | ((state: SafeVaultState) => string | undefined) | – |
Other exports
safeVaultLabelscreateVaultMotionuseSafeVaultMotionuseSafeVaultStagedenyMslockedPoselockMsmotionDonemotionLengthmotionTowardsopenDegreesposeAtrestingunlockedPoseunlockMsapplyMatrixbackInsidebodyCenterYboltCountcameraFovDegreescameraPositionceilingInsidedepthdialOnDoordialRadiusdialRectdoorCenterdoorDepthdoorEdgesdoorFrontZdoorHeightdoorWidthfloorInsideframingForframeheightliftliningFrontonDooropeningWidthopeningHeightpanelDepthpanelFacepanelRowspanelSeampivotplaneMatrixplaqueCornersplaqueFaceplaqueHeightForplaqueLayoutWidthplaqueMaxHeightplaqueMinHeightplaqueRowCenterplaqueWidthpolygonAreaprojectionscrewInsetsettledFramingvisibleOpeningwidthcreateSafeVaultStagesupportsSafeVaultStagecreateVaultSceneenvironmentCubeSizeshadowMapSizematerialsroundedRectsizedstudiobrushedLinescontactShadowdialFaceknurlorangePeelradialBrushsafeTextureSizescreateSafeVaultRunnerserveSafeVaultRunnertype SafeVaultLabelstype SafeVaultPropstype SafeVaultStatetype SafeVaultStatustype SafeVaultStatusChangeDetailstype VaultMotionSnapshottype Posetype SafeVaultMotiontype Framingtype Projectiontype Recttype StagePointtype Vectortype SafeVaultStagetype VaultInputtype VaultScenetype VaultStatetype MaterialsAccessibility
- The dial is SafeDial: a slider over its numbers and the code as UI SDK's OTP input, so keys, paste and autofill work as there.
- The contents aren't in the page while it's locked; once unlocked they sit in a region named by labels.contents, inert until the door has opened; once locked they are inert and aria-hidden at once and leave the page when the door has shut. A polite status says Unlocked (or Wrong combination when denied).
- Under reduced motion the door and the camera jump to the end and a denied code clears at once.
- The 3D safe is a picture hidden from assistive tech; the plaque on its back wall is the real DOM, mapped onto the wall with a CSS transform.
Agent actions
Agents call enter("27-46-13-33") by the vault label, as on SafeDial, and press Lock; the contents become readable to them only once the app unlocks it.
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.