A 3D tilting card with a pointer-tracked holographic glare and texture overlay, built for membership cards, passes, and collectibles.
import {HoloCard} from "@heroui-pro/react";
<HoloCard>
<HoloCard.Rotator>
<HoloCard.Frame>
<HoloCard.Surface>
<HoloCard.Image alt="" src={src} /> {/* Optional: card art */}
<HoloCard.Inset /> {/* Optional: hairline border */}
<HoloCard.Pattern /> {/* Optional: static texture */}
<HoloCard.Content>{/* ... */}</HoloCard.Content> {/* Optional */}
<HoloCard.Shine> {/* Optional: holographic glare */}
<HoloCard.ShinePattern /> {/* Optional */}
</HoloCard.Shine>
</HoloCard.Surface>
</HoloCard.Frame>
</HoloCard.Rotator>
</HoloCard>;The card is portrait by default. Swap --holo-card-width and --holo-card-height for a
landscape payment card, such as ISO/IEC 7810 ID-1 proportions (85.6 × 54mm).
HoloCard.Content is a full-bleed layer that drifts against the tilt. Render one per
band of the card and position it with flex utilities: the layer ignores the pointer so
stacked layers never block each other.
<HoloCard.Content className="flex-col items-center justify-center">
<span className="text-3xl font-bold text-white">Marcus Wong</span>
</HoloCard.Content>
<HoloCard.Content className="items-end justify-center pb-10">
<span className="text-sm text-white/40">Member #0999</span>
</HoloCard.Content>For a collectible-style card whose face is a single piece of art, render
HoloCard.Image and drop HoloCard.Content entirely. The image fills the surface and
sits at the bottom of the stack, so the glare and texture blend over it.
<HoloCard style={{"--holo-card-width": "210px", "--holo-card-height": "294px"}}>
<HoloCard.Rotator>
<HoloCard.Frame>
<HoloCard.Surface>
<HoloCard.Image alt="Neon-lit game controller" src="/card-art.jpg" />
<HoloCard.Pattern />
<HoloCard.Shine />
</HoloCard.Surface>
</HoloCard.Frame>
</HoloCard.Rotator>
</HoloCard>Set --holo-card-width and --holo-card-height to your art's aspect ratio: the
defaults are 302px × 453px, and 210px × 294px gives trading-card proportions.
Put the art in HoloCard.Image, not in a HoloCard.Content layer. Content stacks above Shine
so it can carry readable text over the glare, which means a full-bleed image there would cover the
holographic effect instead of catching it.
If you want the art as a plain background and have no need for an img element, the
gradient prop takes any CSS background value, so a single prop is enough:
<HoloCard gradient="url('/card-art.jpg') center / cover no-repeat" />Set isInteractive={false} to freeze the card flat and unlit. The card also stays
static automatically when the user has prefers-reduced-motion enabled, and that
preference hands horizontal drags back to the page.
Touch and pen pointers tilt the card too, which means the card claims horizontal drags
that start on it. Set tiltOnTouch={false} to hand every gesture back to the page: a
card inside a carousel or a horizontally scrolling row needs it, or the row will not swipe.
Vertical scrolling and pinch-zoom always reach the page either way.
A live card holds a 3D context and composited layers for as long as it is mounted. That is fine for one card, but a grid of them is a grid of layers, and enough of them will exhaust the memory a mobile browser has for re-rasterizing them on a pinch-zoom.
activateOnHover makes a card earn that cost. It starts flat and inert - no perspective,
no preserve-3d, no will-change, no transform, and no glare layers - builds the 3D
context when a mouse pointer enters, and tears it down once the return spring has
settled. A grid then costs about as much as a grid of images, with only the card under
the pointer on the GPU. Reach for it in any collection of cards:
<HoloCard activateOnHover hoverScale={1.04} maxTilt={8} shineOpacity={0.55}>
{/* ... */}
</HoloCard>The effect is also loud on a card this small, hence the gentler maxTilt, hoverScale,
and shineOpacity. maxTilt also scales the content parallax, because that drift is
derived from the tilt, so a smaller angle moves HoloCard.Content less unless
parallaxStrength is raised to compensate. A smaller tilt and zoom need less room
inside the clipping frame, so --holo-card-bleed can come down with them and tighten
the grid. Use spring and settleSpring to change how the card follows the pointer
and how it comes back.
A card left at the default stays live from the moment it mounts, which is what you want for a single hero card: it is ready the instant the pointer arrives, with no first-hover work at all.
An inert card also cannot tilt under a finger, because the browser decides who owns a
touch as it lands: before the card has had a chance to wake. activateOnHover therefore
implies tiltOnTouch={false}, and a grid on a phone scrolls and pinch-zooms as if the
cards were plain images.
The root reflects the state as data-active="true" | "false", which is also the hook
for styling a card differently while it is live. A card that reserves touch drags for its
tilt carries data-tilt-on-touch="true", which is where its touch-action comes from.
HeroUI follows the BEM methodology to ensure component variants and states are reusable and easy to customize.
The Holo Card component uses these CSS classes:
.holo-card: Perspective wrapper; declares every customization variable.holo-card__rotator: 3D tilt layer.holo-card__frame: Fixed clipping bounds the tilted card moves within.holo-card__surface: The card body carrying the gradient background.holo-card__image: Full-bleed card art beneath every overlay.holo-card__inset: Hairline border inside the card edge.holo-card__pattern: Static texture overlay beneath the content.holo-card__content: Full-bleed parallax layer for the card face.holo-card__shine: Holographic glare, blended over everything else.holo-card__shine-pattern: The texture the glare revealsSet these on the root (or any ancestor) to restyle the card without overriding classes.
| Variable | Default | Description |
|---|---|---|
--holo-card-width | 302px | Card width |
--holo-card-height | 453px | Card height |
--holo-card-radius | 20px | Card corner radius |
--holo-card-bleed | 36px | Slack around the card inside the clipping frame |
--holo-card-perspective | 600px | 3D perspective depth |
--holo-card-gradient | dark gradient | Card surface background |
--holo-card-inset-color | rgb(255 255 255 / .06) | Hairline border color |
--holo-card-pattern | CSS rainbow sheen | Texture image for both overlays |
--holo-card-pattern-size | auto | background-size for both texture layers |
--holo-card-pattern-opacity | 0.9 | Opacity of the holographic texture |
--holo-card-shine-pattern | var(--holo-card-pattern) | Texture the glare reveals; set to none to clear it |
--holo-card-shine-opacity | 1 | Multiplier for the glare at full strength |
--holo-card-texture-opacity | 0.1 | Opacity of the static texture |
--holo-card-content-text-shadow | lift under the card content | Content text shadow; set to none for invisible text |
These are driven by pointer movement and are read-only: --holo-card-pointer-x,
--holo-card-pointer-y, --holo-card-background-x, --holo-card-background-y,
--holo-card-opacity.
The root component. Renders a div that owns pointer tracking and every CSS variable.
It shrink-wraps the card, so wrap it in a flex or grid container to position it.
Every layer is optional except Rotator, Frame, and Surface.
| Prop | Type | Default | Description |
|---|---|---|---|
gradient | string | - | CSS background for the surface. Sets --holo-card-gradient |
patternSrc | string | - | Texture image URL for both overlays. Sets --holo-card-pattern |
patternSize | string | - | background-size for both overlays. Sets --holo-card-pattern-size |
activateOnHover | boolean | false | Whether the card stays flat and inert until a mouse pointer is over it |
tiltOnTouch | boolean | true | Whether touch and pen pointers tilt the card, claiming horizontal drags |
isInteractive | boolean | true | Whether the card tilts and lights up on pointer move |
isDisabled | boolean | false | Disables pointer tracking, leaving the card flat and unlit |
maxTilt | number | 14.29 | Edge tilt in degrees. Also scales the content parallax |
hoverScale | number | 1.05 | Scale the card grows to while the pointer is over it |
shineOpacity | number | 1 | Multiplier for the glare. Sets --holo-card-shine-opacity |
spring | HoloCardSpring | {damping: 28, stiffness: 180} | Spring the card follows the pointer with |
settleSpring | HoloCardSpring | {damping: 22, stiffness: 120} | Spring the card returns to rest with |
parallaxStrength | number | 10 | How far HoloCard.Content layers drift against the tilt |
children | ReactNode | - | Card layers |
className | string | - | Additional CSS class |
HoloCardSpring is {damping?: number; mass?: number; stiffness?: number}, merged over
the defaults above.
Also supports all native div HTML attributes and Motion props.
The 3D tilt layer. Rotates around the card center as the pointer moves.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | Frame element |
className | string | - | Additional CSS class |
Also supports all native div HTML attributes and Motion props.
Fixed clipping bounds that give the scaled, tilted card room to move.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | Surface element |
Also supports all native div HTML attributes.
The card body. Carries the gradient background and clips every layer to the radius.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | Card layers |
Also supports all native div HTML attributes.
Full-bleed card art. Renders an img that covers the surface and sits below every
overlay, so the glare and texture blend over it. The decorative layers above it are
transparent to the pointer, so a right click still opens the browser's image menu. It is
draggable={false} by default, so a native image drag can never interrupt the tilt; pass
draggable to opt back in.
| Prop | Type | Default | Description |
|---|---|---|---|
alt | string | - | Required. Describe the art, or pass "" when it is purely decorative |
src | string | - | Image URL |
draggable | boolean | false | Whether the browser may start a native drag of the art |
Also supports all native img HTML attributes.
Hairline border inset from the card edge. Renders no children.
Supports all native div HTML attributes.
Static texture overlay that sits beneath the content. Renders no children.
Supports all native div HTML attributes.
A full-bleed parallax layer for the card face. Render as many as you need.
| Prop | Type | Default | Description |
|---|---|---|---|
parallax | boolean | true | Whether the layer drifts against the tilt |
children | ReactNode | - | Layer content |
className | string | - | Additional CSS class |
Also supports all native div HTML attributes and Motion props.
The pointer-tracked holographic glare. Renders a HoloCard.ShinePattern when no children are given.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | <ShinePattern /> | Replaces the default texture |
Also supports all native div HTML attributes.
The texture the glare reveals, parallaxed by the pointer. Renders no children.
Supports all native div HTML attributes.
Resources