Catalog npm
Back to packageRELEASE DETAILS

3.3.80

npm

3d-ar-product-card

A lightweight React component for displaying products in both Augmented Reality (AR) and 3D. Perfect for eCommerce applications where you want to showcase your products in an immersive and interactive way.

3d3d-ar3d-model3d-viewarar-productaugmented-realityecommerceinteractive-3dproduct-cardreactreact-3dreact-arreact-ar-cardxr
Published27 Jan 2025
Direct dependencies19
Transitive dependenciesNot calculated

README

Current package documentation

AR 3D Product Card

A lightweight React component for displaying products in both Augmented Reality (AR) and 3D. Perfect for eCommerce applications where you want to showcase your products in an immersive and interactive way.

Installation

You can install the package via npm or yarn:

npm install 3d-ar-product-card

Usage

import { AR3DProductCard } from '3d-ar-product-card';

Basic Example

import React from 'react';
import { AR3DProductCard } from '3d-ar-product-card';

function App() {
  return (
    <div>
      <AR3DProductCard 
        gltfPath="/models/indoor_plant/scene.gltf" 
        imageSrc="/image/1.png" 
      />
    </div>
  );
}

export default App;

Props

  • gltfPath (string): The path to the 3D model file (GLTF format).

  • imageSrc (string): The image to display on the product card.

Setup Require

Make this src/components folder name as Arcomponent.jsx

import { XrHitModelContainer } from '3d-ar-product-card';
import { useLocation } from 'react-router-dom';
import { XrHitModelContainer } from '3d-ar-product-card';

const Arcomponent = () => {
  const location = useLocation();
  const params = new URLSearchParams(location.search);
  const gltfPath = params.get('gltfPath') || './models/default.gltf';

console.log(gltfPath);


  console.log("gltfPath:", gltfPath); // Log the gltfPath for debugging

  return (
    <>
      {gltfPath ? (
        <XrHitModelContainer gltfPath={gltfPath} />
      ) : (
        <p>Error: No valid GLTF path provided.</p>
      )}
    </>
  );
};

export default Arcomponent;


Make route 'xr' of this component

Example



import Arcomponent from "./components/Arcomponent";

const App = () => {
  return(
  <Routes>
   <Route path="/xr" element={<Arcomponent />} />
  </Routes>
 
)};

export default App;

Features

  • AR and 3D views: Allows users to view products in Augmented Reality or 3D directly in their browser.
  • Customizable product card: Easily add products to the card with customizable properties like model path, scale, position, and image.
  • Mobile and Desktop Support: Automatically adjusts based on the device (mobile devices for AR and desktops for 3D).
  • Easy Integration: Simple to use in any React application.

License

MIT License.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 21

Native requirements
19 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
three
Environment
{
  "local_name": "three",
  "alias": false,
  "peer_metadata": null
}
^0.171.0runtime
qrcode.react
Environment
{
  "local_name": "qrcode.react",
  "alias": false,
  "peer_metadata": null
}
^4.1.0runtime
react-toastify
Environment
{
  "local_name": "react-toastify",
  "alias": false,
  "peer_metadata": null
}
^10.0.6runtime
@react-three/xr
Environment
{
  "local_name": "@react-three/xr",
  "alias": false,
  "peer_metadata": null
}
^6.4.12runtime
react-responsive
Environment
{
  "local_name": "react-responsive",
  "alias": false,
  "peer_metadata": null
}
^10.0.0runtime
react-router-dom
Environment
{
  "local_name": "react-router-dom",
  "alias": false,
  "peer_metadata": null
}
^7.0.1runtime
@react-three/drei
Environment
{
  "local_name": "@react-three/drei",
  "alias": false,
  "peer_metadata": null
}
^9.119.0runtime
@react-three/fiber
Environment
{
  "local_name": "@react-three/fiber",
  "alias": false,
  "peer_metadata": null
}
^8.17.10runtime
@google/model-viewer
Environment
{
  "local_name": "@google/model-viewer",
  "alias": false,
  "peer_metadata": null
}
^4.0.0runtime
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
^18.3.1development
postcss
Environment
{
  "local_name": "postcss",
  "alias": false,
  "peer_metadata": null
}
^8.4.49development
react-dom
Environment
{
  "local_name": "react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.3.1development
@babel/cli
Environment
{
  "local_name": "@babel/cli",
  "alias": false,
  "peer_metadata": null
}
^7.25.9development
@babel/core
Environment
{
  "local_name": "@babel/core",
  "alias": false,
  "peer_metadata": null
}
^7.26.0development
tailwindcss
Environment
{
  "local_name": "tailwindcss",
  "alias": false,
  "peer_metadata": null
}
^3.4.15development
autoprefixer
Environment
{
  "local_name": "autoprefixer",
  "alias": false,
  "peer_metadata": null
}
^10.4.20development
@babel/preset-env
Environment
{
  "local_name": "@babel/preset-env",
  "alias": false,
  "peer_metadata": null
}
^7.26.0development
@babel/preset-react
Environment
{
  "local_name": "@babel/preset-react",
  "alias": false,
  "peer_metadata": null
}
^7.25.9development
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
^18.0.0peer
zustand
Environment
{
  "local_name": "zustand",
  "alias": false,
  "peer_metadata": null
}
^4.0.0peer
react-dom
Environment
{
  "local_name": "react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.0.0peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "29802ae4a08d5b45a3636dcdb995a6df716687e3",
  "tarball": "https://registry.npmjs.org/3d-ar-product-card/-/3d-ar-product-card-3.3.80.tgz",
  "fileCount": 10,
  "integrity": "sha512-5ujQI0cpf2QPKHA/JLEO1WuxoxyQdr693Sdflg0aZ2MD1Wrwei1ILH3ehHn94PhWqA+CPCu1vxkbdZqVDamK/A==",
  "signatures": [
    {
      "sig": "MEYCIQCQMsIHfcPjXj8FFozH+BQKd5+cR2bBNeRbhzPJkuoyjwIhANq3SN4sVGYJwGXtmyxmROyMT13iJkg0dshooADZch1x",
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
    }
  ],
  "unpackedSize": 66268
}

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:32 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:41fba978902de2601e9a7b6892eeea012cc45596e7776cd53eb2af4cd2161de3

Other collected versions

3.4.2712 Feb3.4.2612 Feb3.4.2512 Feb3.4.2411 Feb3.4.2311 Feb3.4.2211 FebView all collected versions →