Skip to content

DNA Loader

A rotating double helix with rungs.

CSS 3DTypeScriptLight + AMOLED
Example.tsx
import { Loaders3D } from "@/components/3d/loaders";

export default function Example() {
  return (
    <div style={{ height: 340 }}>
      <Loaders3D
        variant="dna"
        theme="light"
      />
    </div>
  );
}

Deps: three, @react-three/fiber, @react-three/drei, framer-motion

Installation

Install the runtime dependencies, then copy the component module (and the shared 3D core when the component uses WebGL).

terminal
npm install three @react-three/fiber @react-three/drei framer-motion

# Copy the component module
cp -r src/components/3d/loaders <your-project>/src/components/3d/loaders
# Copy the shared 3D core
cp -r src/components/3d/core <your-project>/src/components/3d/core

Dependencies: three, @react-three/fiber, @react-three/drei, framer-motion

Usage

Every category module exposes one typed component. Pick an implementation with variant and pass props grouped by concern.

Example.tsx
import { Loaders3D } from "@/components/3d/loaders";

export default function Example() {
  return (
    <div style={{ height: 340 }}>
      <Loaders3D
        variant="dna"
        theme="light"
      />
    </div>
  );
}

React implementation

With every prop set explicitly. The complete, copyable source of src/components/3d/loaders/index.tsx is available in the playground’s Source tab.

Example.tsx
import { Loaders3D } from "@/components/3d/loaders";

export default function Example() {
  return (
    <div style={{ height: 340 }}>
      <Loaders3D
        variant="dna"
        theme="amoled"
        auto
        progress={60}
        color="#7777ff"
        size={120}
        speed={1}
        showPercent
        reducedMotion={false}
      />
    </div>
  );
}

Next.js implementation

This component is DOM based, but it is still code-split with next/dynamic so interaction code ships only where it's used.

app/dna-loader/page.tsx
// app/dna-loader/page.tsx  (Next.js App Router)
"use client";

import dynamic from "next/dynamic";

// Heavy interactive code is split into its own chunk.
const Loaders3D = dynamic(
  () => import("@/components/3d/loaders").then((m) => m.Loaders3D),
  { ssr: false, loading: () => <div aria-busy="true" style={{ height: 340 }} /> },
);

export default function Page() {
  return (
    <main>
      <div style={{ height: 340 }}>
        <Loaders3D
          variant="dna"
          theme="light"
        />
      </div>
    </main>
  );
}

TypeScript interfaces

DNALoader.types.ts
export type Theme = "light" | "amoled";

export interface DNALoaderProps {
  /** Which 3D Loaders implementation to render */
  variant: "dna";
  theme: Theme;

  /* Animation */
  auto?: boolean; // default true
  speed?: number; // 0–3, default 1

  /* Content */
  progress?: number; // 0–100, default 60
  showPercent?: boolean; // default true

  /* Visual */
  color?: string; // default "#7777ff"
  size?: number; // 60–200, default 120

  /* Accessibility */
  reducedMotion?: boolean; // default false
}

Props reference

PropTypeDefaultGroupDescription
variant"dna"—CoreSelects the implementation.
theme"light" | "amoled"—CoreThemes surfaces, materials and lighting.
autobooleantrueAnimationSimulate progress
progressnumber60ContentProgress (%) (0 – 100)
colorstring (hex)"#7777ff"VisualColor
sizenumber120VisualSize (px) (60 – 200)
speednumber1AnimationAnimation speed (0 – 3)
showPercentbooleantrueContentShow percentage
reducedMotionbooleanfalseAccessibilityForce reduced motion

Customization

Colour props accept any hex string. Content props accept plain strings. Every value shown in the playground maps 1:1 to a prop, so you can design visually and copy the generated code. Use Share to send a pre-configured link or Export to download the configuration JSON.

Customized.tsx
import { Loaders3D } from "@/components/3d/loaders";

export default function Example() {
  return (
    <div style={{ height: 340 }}>
      <Loaders3D
        variant="dna"
        theme="light"
        color="#ff5a36"
      />
    </div>
  );
}

Animation settings

  • autoSimulate progress
  • speedAnimation speed · 0–3

All motion is suspended when prefers-reduced-motion is on.

Theme support

Pass theme="light" or theme="amoled". Surfaces, borders, shadows and text switch via CSS variables (--bg, --card, --fg, --border, --accent). AMOLED uses true #000000. Use the theme switch in the playground toolbar to preview both.

Responsive behavior

The component fills its parent, so size it with the container. Use the playground’s desktop / tablet / mobile selector to test. Layouts use fluid widths and container-relative sizing.

Accessibility notes

  • — role=progressbar with aria-valuenow keeps assistive tech informed.
  • — A reduced-motion mode freezes animation but still shows progress.
  • — The status label is real text.

Performance notes

  • — CSS loaders use only transforms and are GPU-composited.
  • — WebGL loaders reuse the same object and background engines at MEDIUM quality.
  • — Pass progress yourself, or enable auto to simulate.