Skip to content

Holo Code Card

A code block with an interactive holographic surface.

LIVE PREVIEWInteract with the component
Install dependencies

npm install @react-three/fiber three lucide-react prism-react-renderer

CSS Modules

Usage

Matches your current playground settings.

jsx
import HoloCodeCard from "./HoloCodeCard";
export default function Example() {
return (
<HoloCodeCard
title={"HoloCodeCard"}
subtitle={"WebGL holographic foil + crisp code rendering."}
language={"tsx"}
highlightLine={8}
code={"export function cn(...classes: (string | undefined)[]) {\n return classes.filter(Boolean).join(\" \");\n}\n\nexport default function Button({\n label = \"Explore\",\n onClick,\n}: {\n label?: string;\n onClick?: () => void;\n}) {\n return (\n <button className=\"btn\" onClick={onClick}>\n {label}\n </button>\n );\n}"}
colors={[
"#0a0b14",
"#6ad4ff",
"#f0b8ff"
]}
intensity={1}
tilt={1}
parallax={1}
minHeight={420}
/>
);
}

Using Holo Code Card

Pass the code sample through code, with language and title describing what the reader is seeing.

Use highlightLine to direct attention to a relevant line. Avoid using motion or decorative badges as the only explanation of the sample.

Props

NameTypeRequiredDefaultDescription
titlestringNo""Short title shown in the card header.
badgeLabelstringNo""Badge Label.
subtitlestringNo""Supporting line beneath the title in the header.
languagestringNo"tsx"Language identifier used for syntax highlighting.
codestringNo""Code snippet rendered in the highlighted block.
highlightLinenumberNo8Line number to emphasize in the snippet.
classNamestringNoundefinedAdditional CSS class names, merged with base component styles.
colorsstring[]No["#0a0b14", "#6ad4ff", "#f0b8ff"]Array of up to three colors used for the backdrop gradients and foil tint.
intensitynumberNo1Overall brightness of the holographic foil effect.
tiltnumberNo1How much the card tilts as you move the pointer.
parallaxnumberNo1How much the foil shifts with pointer movement.
minHeightnumber | stringNo420Minimum height for the component container. Accepts a number (pixels) or any valid CSS height string.

Related components

A paper flap lifts in 3D as a message slides out of its envelope.

A lightly textured receipt pairs precise item rows with a torn paper edge.

A suspended badge swings naturally after you drag and release its handle.

Fine metallic grooves catch a shifting iridescent pointer highlight.