Vilqor

3D Glass Cube Hero

Heroes 1

About

Drop-in 3D hero for your landing page: a cube of frosted glass that glows from inside, made of eight blocks that turn on their own while the camera circles and zooms. Visitors spin it by drag, pinch, scroll or arrow keys. One React component with a WebGL shader inside: no three.js, no Spline file, no 3D models or images to load. Use it as an interactive 3D hero or background for a SaaS or AI product, a launch or coming-soon page, a portfolio, or a modules and integrations section. Brand it in seconds: eight palettes to try in the demo (Fire, Blue, Violet, Sunset, Ocean, Lavender, Aurora, Ice) or your own colors, glass from frosted to clear (glassmorphism), adjustable glow and shadow. Comes in a light studio and a dark dusk version: pick one or let it follow your site's theme (shadcn/ui, Tailwind CSS); a client component for Next.js. It lowers its resolution when a slow GPU drops frames and stops drawing off screen. Keyboard controls, screen-reader labels and reduced-motion support.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds 3D Glass Cube Hero to your project and fits it to your theme.

Code

How 3D Glass Cube Hero is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import * as React from "react"
import { GLASS_CUBE_PALETTES, GlassCube, type GlassCubePalette } from "@/components/ui/glass-cube"

const settings = {
  top: "#ffcc4d",
  upper: "#ff8c26",
  lower: "#ff4d33",
  bottom: "#e6264d",
  glass: "#ffe6db",
  clarity: 0.52,
  glow: 1.9,
  shadow: 1,
  autoplay: true,
}

// The ready colour sets as dots under the cube: one click repaints it, and the name is the `palette` prop to use.
// At the bottom, because 21st puts its own preview buttons in the top left corner.
const PICKS: { id: GlassCubePalette; name: string }[] = [
  { id: "fire", name: "Fire" },
  { id: "blue", name: "Blue" },
  { id: "violet", name: "Violet" },
  { id: "sunset", name: "Sunset" },
  { id: "ocean", name: "Ocean" },
  { id: "lavender", name: "Lavender" },
  { id: "aurora", name: "Aurora" },
  { id: "ice", name: "Ice" },
]

const css = `
.gc-pick{position:absolute;bottom:16px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:6px;padding:6px 14px 6px 6px;border-radius:999px;background:rgb(255 255 255/.86);border:1px solid rgb(255 255 255/.9);box-shadow:0 10px 30px rgb(30 28 48/.16);color:#23262f;font:500 13px/1 ui-sans-serif,system-ui,sans-serif;white-space:nowrap}
.gc-dot{width:24px;height:24px;padding:0;border:0;border-radius:50%;cursor:pointer;box-shadow:inset 0 0 0 1px rgb(0 0 0/.08);transition:transform .15s}
.gc-dot:hover{transform:scale(1.12)}
.gc-dot:focus-visible{outline:2px solid #23262f;outline-offset:2px}
.gc-dot[aria-pressed=true]{box-shadow:0 0 0 2px #fff,0 0 0 4px #23262f}
.gc-name{min-width:58px;padding-left:4px}
@media (max-width:360px){.gc-pick{gap:5px;padding:5px}.gc-dot{width:22px;height:22px}.gc-name{display:none}}
@media (prefers-reduced-motion:reduce){.gc-dot{transition:none}}
`

export default function Demo(props: Partial<typeof settings>) {
  const s = { ...settings, ...props }
  const own: [string, string, string, string] = [s.bottom, s.lower, s.upper, s.top]
  // a dot picks a ready set; changing a colour in the settings shows those colours again
  const [picked, setPicked] = React.useState<GlassCubePalette | null>(null)
  const ownKey = [...own, s.glass].join()
  React.useEffect(() => setPicked(null), [ownKey])
  const set = picked ? GLASS_CUBE_PALETTES[picked] : null
  const light: [string, string, string, string] = set ? [...set.light] : own
  const glass = set ? set.glass : s.glass
  const active = PICKS.find(({ id }) => {
    const p = GLASS_CUBE_PALETTES[id]
    return p.glass === glass.toLowerCase() && p.light.every((c, i) => c === light[i].toLowerCase())
  })

  return (
    <div className="relative h-svh w-full">
      <style>{css}</style>
      <GlassCube
        lightColors={light}
        glassColor={glass}
        clarity={s.clarity}
        glow={s.glow}
        shadow={s.shadow}
        autoplay={s.autoplay}
      />
      <div className="gc-pick" role="group" aria-label="Cube colors" data-palette-picker>
        {PICKS.map(({ id, name }) => (
          <button
            key={id}
            type="button"
            className="gc-dot"
            title={name}
            aria-label={name}
            aria-pressed={active?.id === id}
            onClick={() => setPicked(id)}
            style={{ background: `linear-gradient(0deg, ${GLASS_CUBE_PALETTES[id].light.join(", ")})` }}
          />
        ))}
        <span className="gc-name" aria-live="polite">
          {active ? active.name : "Custom"}
        </span>
      </div>
    </div>
  )
}

More by Vilqor

View all
  • Footer with Big Wordmark

    Footer with Big Wordmark

    132
  • Guilloche Background Pattern

    Guilloche Background Pattern

    7
  • Card Carousel to Grid

    Card Carousel to Grid

  • AI Email Reply with Tones

    AI Email Reply with Tones

  • AI Memory Timeline

    AI Memory Timeline

  • Use Cases Tabs Section

    Use Cases Tabs Section

  • Pricing Section with Toggle

    Pricing Section with Toggle

  • Logo Cloud Marquee

    Logo Cloud Marquee

More in Heroes

View all
  • Agency Hero Section

    Agency Hero Section

    1.1K
  • SaaS Template

    SaaS Template

    2.7K
  • Hero Section 01

    Hero Section 01

    68
  • Facts Hero

    Facts Hero

    9
  • Responsive Hero Banner

    Responsive Hero Banner

    2.2K
  • Hero

    Hero

    1.4K
  • Real Estate 3D Hero

    Real Estate 3D Hero

    57
  • Centered Hero with Image Fan

    Centered Hero with Image Fan

    1.1K