Founding price: $35, then $79.99 after 23:59 UTC on 4 November, then $79.99
Get Pro3D effects draw attention, and they also cost the most: a WebGL context, a render loop and often a large library. This guide covers how to use them so the rest of the page stays fast and accessible.
The library includes several components that render in 3D or fake depth, for example:
cobe, a
library of about 5 kB.More components built on three.js and
React Three Fiber are being added. Those list
three and @react-three/fiber (and sometimes @react-three/drei) as
dependencies, and the CLI installs them for you. Check the component page
for its exact dependencies before you install.
3D code is heavy, so keep it out of the first load. In a client component,
import it with next/dynamic and turn off server rendering, since WebGL only
exists in the browser:
"use client"
import dynamic from "next/dynamic"
const Globe = dynamic(
() => import("@/components/ui/globe").then((mod) => mod.Globe),
{
ssr: false,
loading: () => <div className="bg-muted aspect-square rounded-full" />,
}
)
export function HeroGlobe() {
return <Globe />
}Outside Next.js, React.lazy with Suspense does the same job. Reserve the
component's space with a fixed aspect ratio so nothing shifts when it loads.
IntersectionObserver) and when the tab is hidden
(document.visibilityState).frameloop="demand" for scenes that only need
to redraw on interaction.dpr={[1, 2]}) so phones with 3x
screens don't render nine times the pixels.When prefers-reduced-motion is set, render a still frame: stop
auto-rotation and drift, and keep direct manipulation such as dragging. See
Motion and reduced motion.
role="img" and an aria-label, or describe it in nearby text.
If it is decoration, hide it with aria-hidden.Test on a mid-range phone, not just your laptop. Watch the frame rate and the main-thread time in your browser's performance panel, and make sure the page's Largest Contentful Paint is the text, not the canvas.