🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

3dsvg

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

3dsvg

The easiest way to turn SVGs into interactive React 3D components

latest
Source
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

3dsvg

3dsvg

The easiest way to turn SVGs into interactive React 3D components.

License: MIT npm npm bundle size

Install

npm install 3dsvg

Peer dependencies: react, react-dom, three, @react-three/fiber, @react-three/drei

Quick Start

import { SVG3D } from "3dsvg";

// 3D text
<SVG3D text="Hello" animate="spin" />

// SVG from your public folder
<SVG3D svg="/logo.svg" material="gold" animate="float" />

// Inline SVG markup
<SVG3D svg='<svg viewBox="0 0 24 24"><path d="M12 2L2 7l10 5 10-5z"/></svg>' />

// Remote URL
<SVG3D svg="https://cdn.example.com/icon.svg" material="metal" />

Next.js — wrap with next/dynamic for SSR safety:

const SVG3D = dynamic(
  () => import("3dsvg").then((m) => ({ default: m.SVG3D })),
  { ssr: false }
);

Demo & Editor

Design 3D objects visually and export embed code at 3dsvg.design.

Props

Content

Provide either text or svg. If both are given, svg takes priority.

PropTypeDefaultDescription
textstringText to render in 3D
fontstring"DM Sans"Google Font name (see available fonts)
svgstringSVG markup or URL (/logo.svg, https://..., ./path.svg)

Shape

PropTypeDefaultDescription
depthnumber1Extrusion depth (0.5 = flat, 10 = very deep)
smoothnessnumber0.2Curve and bevel quality, 0–1
colorstring"#ffffff"Base color (hex)

Material

PropTypeDefaultDescription
materialMaterialPreset"default"Material preset (see below)
metalnessnumberOverride preset metalness (0–1)
roughnessnumberOverride preset roughness (0–1)
opacitynumberOverride preset opacity (0–1)
wireframebooleanfalseWireframe rendering mode

Material presets:

PresetMetalnessRoughnessNotes
default0.150.35Balanced starting point
plastic0.00.3Smooth, non-reflective
metal0.90.2Brushed metal
glass0.10.05Transparent with refraction
rubber0.00.9Matte, soft
chrome1.00.05Mirror-like reflections
gold1.00.25Gold tint applied automatically
clay0.01.0Fully matte
emissive0.00.5Self-illuminated glow
holographic0.80.1Transparent with clearcoat

Texture

PropTypeDefaultDescription
texturestringImage URL to map onto the 3D surface
textureRepeatnumber1How many times the texture tiles
textureRotationnumber0Texture rotation in radians
textureOffset[number, number][0, 0]UV offset [x, y]

When a texture is set, the base color is overridden to white so the texture renders at full fidelity.

Lighting

PropTypeDefaultDescription
lightPosition[number, number, number][5, 8, 5]Key light position [x, y, z]
lightIntensitynumber1.2Key light brightness
ambientIntensitynumber0.3Ambient fill light
shadowbooleantrueShow contact shadows

Camera

PropTypeDefaultDescription
rotationXnumber0Initial X rotation (radians)
rotationYnumber0Initial Y rotation (radians)
zoomnumber8Camera distance
fovnumber50Field of view (degrees)

The camera automatically adjusts on narrow/portrait viewports — it zooms out proportionally so the 3D object always fits within the visible area.

Interaction

PropTypeDefaultDescription
interactivebooleantrueMaster toggle — false disables drag, zoom, and orbit
cursorOrbitbooleantrueObject subtly follows the cursor
orbitStrengthnumber0.15How strongly the object follows the cursor (radians)
draggablebooleantrueAllow drag to rotate
scrollZoombooleanfalseAllow scroll to zoom (off by default so embeds don't hijack page scroll)
resetOnIdlebooleanfalseReturn to default position after inactivity
resetDelaynumber2Seconds before reset triggers

Animation

PropTypeDefaultDescription
animateAnimationType"none"Loop animation type (see below)
animateSpeednumber1Speed multiplier
animateReversebooleanfalseReverse direction

Animation types: none · spin · float · pulse · wobble · spinFloat · swing

Intro

PropTypeDefaultDescription
introstring"zoom"Intro animation: zoom · fade · none
introDurationnumber2.5Duration in seconds
introFromobject{ zoom: 18, opacity: 0 }Starting state
introToobject{ zoom: 8, opacity: 1 }Ending state

Layout

PropTypeDefaultDescription
widthstring | number"100%"Container width
heightstring | number"100%"Container height
backgroundstring"transparent"Canvas background color
classNamestringCSS class on the wrapper div

Events

PropTypeDescription
onReady() => voidFires when WebGL context is ready and first frame is rendered
onAnimationComplete() => voidFires when the intro animation finishes
onLoadingChange(loading: boolean, progress: number) => voidFires during geometry processing with loading state and progress (0-100). Use this to show custom loading UI.

Geometry processing is asynchronous — complex SVGs are processed in batches to keep the browser responsive. The onLoadingChange callback lets you track progress and show a loading indicator:

<SVG3D
  svgString={complexSvg}
  onLoadingChange={(loading, progress) => {
    if (loading) console.log(`Processing: ${progress}%`);
    else console.log("Done");
  }}
/>

Available Fonts

DM Sans · Bebas Neue · Playfair Display · Righteous · Black Ops One · Permanent Marker · Rubik Mono One · Pacifico · Oswald · Archivo Black

License

MIT — Renato Costa

Made in Blueberry 🫐

Keywords

3d

FAQs

Package last updated on 09 Apr 2026

Did you know?

Socket

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.

Install

Related posts