
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
unicornstudio-react
Advanced tools
React component for embedding Unicorn.Studio interactive scenes with TypeScript support. Compatible with React (Vite) and Next.js.
A React component for embedding Unicorn.Studio interactive scenes in your applications. Compatible with both React (Vite) and Next.js frameworks.
⚠️ Important: This package is a community-created wrapper component and is not officially affiliated with Unicorn.Studio. It depends on Unicorn.Studio's proprietary script and services.
npm install unicornstudio-react
# or
yarn add unicornstudio-react
# or
pnpm add unicornstudio-react
This package supports both React (Vite/CRA) and Next.js environments with optimized imports:
Use the default import for standard React applications:
import UnicornScene from "unicornstudio-react";
export default function MyComponent() {
return (
<UnicornScene projectId="YOUR_PROJECT_EMBED_ID" width={800} height={600} />
);
}
Use the Next.js-optimized version with enhanced performance:
import UnicornScene from "unicornstudio-react/next";
export default function MyComponent() {
return (
<UnicornScene projectId="YOUR_PROJECT_EMBED_ID" width={800} height={600} />
);
}
Note: The Next.js version uses Next.js
ScriptandImagecomponents for better performance and optimization. The React version uses standard<script>and<img>elements for broader compatibility.
React (Vite/CRA):
import UnicornScene from "unicornstudio-react";
export default function MyComponent() {
return (
<UnicornScene
jsonFilePath="/path/to/your/scene.json"
width="100%"
height="400px"
scale={0.8}
dpi={2}
/>
);
}
Next.js:
import UnicornScene from "unicornstudio-react/next";
export default function MyComponent() {
return (
<UnicornScene
jsonFilePath="/path/to/your/scene.json"
width="100%"
height="400px"
scale={0.8}
dpi={2}
/>
);
}
Both React and Next.js versions support the same props:
// For React: import UnicornScene from "unicornstudio-react";
// For Next.js: import UnicornScene from "unicornstudio-react/next";
import UnicornScene from "unicornstudio-react";
export default function MyComponent() {
const handleLoad = () => {
console.log("Scene loaded successfully!");
};
const handleError = (error: Error) => {
console.error("Scene loading failed:", error);
};
return (
<UnicornScene
projectId="YOUR_PROJECT_EMBED_ID"
width="100vw"
height="100vh"
scale={1}
dpi={1.5}
fps={60}
altText="Interactive 3D scene"
ariaLabel="Animated background scene"
className="my-custom-class"
lazyLoad={true}
production={true}
onLoad={handleLoad}
onError={handleError}
/>
);
}
Use the sceneRef prop when you want access to the underlying Unicorn Studio scene object after it initializes.
import { useRef } from "react";
import UnicornScene, { type UnicornStudioScene } from "unicornstudio-react";
export default function MyComponent() {
const sceneRef = useRef<UnicornStudioScene | null>(null);
const pauseScene = () => {
if (sceneRef.current) {
sceneRef.current.paused = true;
}
};
const resizeScene = () => {
sceneRef.current?.resize?.();
};
return (
<>
<UnicornScene
projectId="YOUR_PROJECT_EMBED_ID"
width={800}
height={600}
sceneRef={sceneRef}
/>
<button onClick={pauseScene}>Pause</button>
<button onClick={resizeScene}>Resize</button>
</>
);
}
The sceneRef value is assigned once the scene finishes loading and is cleared automatically if the scene is destroyed or re-initialized.
The component now supports flexible placeholder options that can be displayed while loading, on error, or when WebGL is not supported.
<UnicornScene
projectId="YOUR_PROJECT_ID"
placeholder="/path/to/placeholder.jpg"
width={800}
height={600}
/>
<UnicornScene
projectId="YOUR_PROJECT_ID"
placeholderClassName="bg-gradient-to-r from-blue-500 to-purple-600 animate-pulse"
width="100%"
height="400px"
/>
<UnicornScene
projectId="YOUR_PROJECT_ID"
placeholder={
<div className="flex items-center justify-center h-full bg-gray-100">
<div className="text-center">
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-gray-900 mx-auto"></div>
<p className="mt-4 text-gray-600">Loading 3D Scene...</p>
</div>
</div>
}
width={600}
height={400}
/>
showPlaceholderWhileLoading: Shows placeholder during scene initialization (default: true)showPlaceholderOnError: Shows placeholder when scene fails to load (default: true)| Prop | Type | Default | Description |
|---|---|---|---|
projectId | string | - | The Unicorn Studio project embed ID (required if not using jsonFilePath) |
jsonFilePath | string | - | Path to a self-hosted JSON file (required if not using projectId) |
width | number | string | "100%" | Width of the scene container |
height | number | string | "100%" | Height of the scene container |
scale | number | 1 | Rendering scale (0.25-1, lower values improve performance) |
dpi | number | 1.5 | Pixel ratio for rendering quality |
fps | number | 60 | Frames per second (0-120) |
altText | string | "Scene" | Alternative text for accessibility |
ariaLabel | string | - | ARIA label for the scene |
className | string | "" | Additional CSS classes |
lazyLoad | boolean | true | Load scene only when scrolled into view |
production | boolean | true | Use production CDN |
paused | boolean | false | Pause or resume the scene animation |
placeholder | string | ReactNode | - | Placeholder content (image URL or React component) |
placeholderClassName | string | - | CSS classes for placeholder div (when using CSS placeholder) |
showPlaceholderOnError | boolean | true | Show placeholder when scene fails to load |
showPlaceholderWhileLoading | boolean | true | Show placeholder while scene is loading |
onLoad | () => void | - | Callback when scene loads successfully |
onError | (error: Error) => void | - | Callback when scene fails to load |
sceneRef | Ref<UnicornStudioScene | null> | - | Ref that receives the initialized Unicorn Studio scene instance |
The component uses inline styles for maximum compatibility. You can customize the appearance by:
className prop to add your own CSS classes<div style={{ "--unicorn-width": "100%", "--unicorn-height": "500px" }}>
<UnicornScene projectId="YOUR_PROJECT_ID" />
</div>
/next)This component depends on Unicorn.Studio's proprietary script (unicornStudio.umd.js) which:
// ⚠️ Use custom script URL (may violate Unicorn.Studio TOS)
// Only use if you have explicit permission from Unicorn.Studio
const constants = {
UNICORN_STUDIO_CDN_URL: "https://your-custom-cdn.com/unicornStudio.umd.js",
};
Warning: Using a custom script URL may violate Unicorn.Studio's Terms of Service. Consult their legal terms before implementing.
React/Next.js Example usage:
<UnicornScene
projectId="YOUR_PROJECT_EMBED_ID"
sdkUrl="https://your-custom-cdn.com/unicornStudio.umd.js"
width={800}
height={600}
/>
This package's version follows Unicorn.Studio's script version (e.g., v1.4.26) to ensure compatibility. Version format:
1.4.26 - Matches Unicorn.Studio script v1.4.261.4.26-1) may be added for component-specific fixesprojectId and jsonFilePathscale prop valuedpi settingfps for less demanding animationsThis component is based on the official Unicorn.Studio React example with the following improvements:
Modern React Patterns
Script component for optimized loadingBetter Architecture
Enhanced Developer Experience
Production Ready
This React component wrapper is released under the MIT License - see the LICENSE file for details.
This package is a community-created wrapper and is not officially affiliated with Unicorn.Studio or UNCRN LLC. The authors of this package:
For official support or licensing questions regarding Unicorn.Studio, contact Unicorn.Studio directly.
Contributions are welcome! Please feel free to submit a Pull Request.
git clone https://github.com/diegopeixoto/unicornstudio-react.git
cd unicornstudio-react
npm install
npm run dev
Author: Diego Peixoto
License: MIT (for this wrapper component only)
Not affiliated with: Unicorn.Studio or UNCRN LLC
FAQs
React component for embedding Unicorn.Studio interactive scenes with TypeScript support. Compatible with React (Vite) and Next.js.
The npm package unicornstudio-react receives a total of 16,410 weekly downloads. As such, unicornstudio-react popularity was classified as popular.
We found that unicornstudio-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.